Gutenberg - Version 11.8.0

Version Description

Download this release

Release Info

Developer dd32
Plugin Icon 128x128 Gutenberg
Version 11.8.0
Comparing to
See all releases

Code changes from version v11.7.1 to 11.8.0

build/api-fetch/index.js CHANGED
@@ -183,7 +183,7 @@ function createPreloadingMiddleware(preloadedData) {
183
  const path = getStablePath(options.path);
184
 
185
  if ('GET' === method && cache[path]) {
186
- const cacheData = cache[path]; // Unsetting the cache key ensures that the data is only preloaded a single time
187
 
188
  delete cache[path];
189
  return Promise.resolve(parse ? cacheData.body : new window.Response(JSON.stringify(cacheData.body), {
@@ -192,7 +192,10 @@ function createPreloadingMiddleware(preloadedData) {
192
  headers: cacheData.headers
193
  }));
194
  } else if ('OPTIONS' === method && cache[method] && cache[method][path]) {
195
- return Promise.resolve(parse ? cache[method][path].body : cache[method][path]);
 
 
 
196
  }
197
  }
198
 
183
  const path = getStablePath(options.path);
184
 
185
  if ('GET' === method && cache[path]) {
186
+ const cacheData = cache[path]; // Unsetting the cache key ensures that the data is only used a single time
187
 
188
  delete cache[path];
189
  return Promise.resolve(parse ? cacheData.body : new window.Response(JSON.stringify(cacheData.body), {
192
  headers: cacheData.headers
193
  }));
194
  } else if ('OPTIONS' === method && cache[method] && cache[method][path]) {
195
+ const cacheData = cache[method][path]; // Unsetting the cache key ensures that the data is only used a single time
196
+
197
+ delete cache[method][path];
198
+ return Promise.resolve(parse ? cacheData.body : cacheData);
199
  }
200
  }
201
 
build/api-fetch/index.min.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('wp-i18n', 'wp-polyfill', 'wp-url'), 'version' => '84a05b2df76d7af2c946b839f1860969');
1
+ <?php return array('dependencies' => array('wp-i18n', 'wp-polyfill', 'wp-url'), 'version' => '5727823574aff5a0652d4fb98207a116');
build/api-fetch/index.min.js CHANGED
@@ -1 +1 @@
1
- !function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t={};e.d(t,{default:function(){return j}});var r=window.wp.i18n,n=(e,t)=>{let r,n,o=e.path;return"string"==typeof e.namespace&&"string"==typeof e.endpoint&&(r=e.namespace.replace(/^\/|\/$/g,""),n=e.endpoint.replace(/^\//,""),o=n?r+"/"+n:r),delete e.namespace,delete e.endpoint,t({...e,path:o})};function o(e){const t=e.split("?"),r=t[1],n=t[0];return r?n+"?"+r.split("&").map((e=>e.split("="))).sort(((e,t)=>e[0].localeCompare(t[0]))).map((e=>e.join("="))).join("&"):n}var a=window.wp.url;const s=({path:e,url:t,...r},n)=>({...r,url:t&&(0,a.addQueryArgs)(t,n),path:e&&(0,a.addQueryArgs)(e,n)}),i=e=>e.json?e.json():Promise.reject(e),c=e=>{const{next:t}=(e=>{if(!e)return{};const t=e.match(/<([^>]+)>; rel="next"/);return t?{next:t[1]}:{}})(e.headers.get("link"));return t};var d=async(e,t)=>{if(!1===e.parse)return t(e);if(!(e=>{const t=!!e.path&&-1!==e.path.indexOf("per_page=-1"),r=!!e.url&&-1!==e.url.indexOf("per_page=-1");return t||r})(e))return t(e);const r=await j({...s(e,{per_page:100}),parse:!1}),n=await i(r);if(!Array.isArray(n))return n;let o=c(r);if(!o)return n;let a=[].concat(n);for(;o;){const t=await j({...e,path:void 0,url:o,parse:!1}),r=await i(t);a=a.concat(r),o=c(t)}return a};const p=new Set(["PATCH","PUT","DELETE"]),u="GET",l=(e,t=!0)=>Promise.resolve(((e,t=!0)=>t?204===e.status?null:e.json?e.json():Promise.reject(e):e)(e,t)).catch((e=>h(e,t)));function h(e,t=!0){if(!t)throw e;return(e=>{const t={code:"invalid_json",message:(0,r.__)("The response is not a valid JSON response.")};if(!e||!e.json)throw t;return e.json().catch((()=>{throw t}))})(e).then((e=>{const t={code:"unknown_error",message:(0,r.__)("An unknown error occurred.")};throw e||t}))}const f={Accept:"application/json, */*;q=0.1"},w={credentials:"include"},m=[(e,t)=>("string"!=typeof e.url||(0,a.hasQueryArg)(e.url,"_locale")||(e.url=(0,a.addQueryArgs)(e.url,{_locale:"user"})),"string"!=typeof e.path||(0,a.hasQueryArg)(e.path,"_locale")||(e.path=(0,a.addQueryArgs)(e.path,{_locale:"user"})),t(e)),n,(e,t)=>{const{method:r=u}=e;return p.has(r.toUpperCase())&&(e={...e,headers:{...e.headers,"X-HTTP-Method-Override":r,"Content-Type":"application/json"},method:"POST"}),t(e)},d],g=e=>{if(e.status>=200&&e.status<300)return e;throw e};let y=e=>{const{url:t,path:n,data:o,parse:a=!0,...s}=e;let{body:i,headers:c}=e;return c={...f,...c},o&&(i=JSON.stringify(o),c["Content-Type"]="application/json"),window.fetch(t||n||window.location.href,{...w,...s,body:i,headers:c}).then((e=>Promise.resolve(e).then(g).catch((e=>h(e,a))).then((e=>l(e,a)))),(e=>{if(e&&"AbortError"===e.name)throw e;throw{code:"fetch_error",message:(0,r.__)("You are probably offline.")}}))};function _(e){return m.reduceRight(((e,t)=>r=>t(r,e)),y)(e).catch((t=>"rest_cookie_invalid_nonce"!==t.code?Promise.reject(t):window.fetch(_.nonceEndpoint).then(g).then((e=>e.text())).then((t=>(_.nonceMiddleware.nonce=t,_(e))))))}_.use=function(e){m.unshift(e)},_.setFetchHandler=function(e){y=e},_.createNonceMiddleware=function(e){const t=(e,r)=>{const{headers:n={}}=e;for(const o in n)if("x-wp-nonce"===o.toLowerCase()&&n[o]===t.nonce)return r(e);return r({...e,headers:{...n,"X-WP-Nonce":t.nonce}})};return t.nonce=e,t},_.createPreloadingMiddleware=function(e){const t=Object.keys(e).reduce(((t,r)=>(t[o(r)]=e[r],t)),{});return(e,r)=>{const{parse:n=!0}=e;if("string"==typeof e.path){const r=e.method||"GET",a=o(e.path);if("GET"===r&&t[a]){const e=t[a];return delete t[a],Promise.resolve(n?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}if("OPTIONS"===r&&t[r]&&t[r][a])return Promise.resolve(n?t[r][a].body:t[r][a])}return r(e)}},_.createRootURLMiddleware=e=>(t,r)=>n(t,(t=>{let n,o=t.url,a=t.path;return"string"==typeof a&&(n=e,-1!==e.indexOf("?")&&(a=a.replace("?","&")),a=a.replace(/^\//,""),"string"==typeof n&&-1!==n.indexOf("?")&&(a=a.replace("?","&")),o=n+a),r({...t,url:o})})),_.fetchAllMiddleware=d,_.mediaUploadMiddleware=(e,t)=>{if(!function(e){const t=!!e.method&&"POST"===e.method;return(!!e.path&&-1!==e.path.indexOf("/wp/v2/media")||!!e.url&&-1!==e.url.indexOf("/wp/v2/media"))&&t}(e))return t(e);let n=0;const o=e=>(n++,t({path:`/wp/v2/media/${e}/post-process`,method:"POST",data:{action:"create-image-subsizes"},parse:!1}).catch((()=>n<5?o(e):(t({path:`/wp/v2/media/${e}?force=true`,method:"DELETE"}),Promise.reject()))));return t({...e,parse:!1}).catch((t=>{const n=t.headers.get("x-wp-upload-attachment-id");return t.status>=500&&t.status<600&&n?o(n).catch((()=>!1!==e.parse?Promise.reject({code:"post_process",message:(0,r.__)("Media upload failed. If this is a photo or a large image, please scale it down and try again.")}):Promise.reject(t))):h(t,e.parse)})).then((t=>l(t,e.parse)))};var j=_;(window.wp=window.wp||{}).apiFetch=t.default}();
1
+ !function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t={};e.d(t,{default:function(){return j}});var r=window.wp.i18n,n=(e,t)=>{let r,n,o=e.path;return"string"==typeof e.namespace&&"string"==typeof e.endpoint&&(r=e.namespace.replace(/^\/|\/$/g,""),n=e.endpoint.replace(/^\//,""),o=n?r+"/"+n:r),delete e.namespace,delete e.endpoint,t({...e,path:o})};function o(e){const t=e.split("?"),r=t[1],n=t[0];return r?n+"?"+r.split("&").map((e=>e.split("="))).sort(((e,t)=>e[0].localeCompare(t[0]))).map((e=>e.join("="))).join("&"):n}var a=window.wp.url;const s=({path:e,url:t,...r},n)=>({...r,url:t&&(0,a.addQueryArgs)(t,n),path:e&&(0,a.addQueryArgs)(e,n)}),i=e=>e.json?e.json():Promise.reject(e),c=e=>{const{next:t}=(e=>{if(!e)return{};const t=e.match(/<([^>]+)>; rel="next"/);return t?{next:t[1]}:{}})(e.headers.get("link"));return t};var d=async(e,t)=>{if(!1===e.parse)return t(e);if(!(e=>{const t=!!e.path&&-1!==e.path.indexOf("per_page=-1"),r=!!e.url&&-1!==e.url.indexOf("per_page=-1");return t||r})(e))return t(e);const r=await j({...s(e,{per_page:100}),parse:!1}),n=await i(r);if(!Array.isArray(n))return n;let o=c(r);if(!o)return n;let a=[].concat(n);for(;o;){const t=await j({...e,path:void 0,url:o,parse:!1}),r=await i(t);a=a.concat(r),o=c(t)}return a};const p=new Set(["PATCH","PUT","DELETE"]),u="GET",l=(e,t=!0)=>Promise.resolve(((e,t=!0)=>t?204===e.status?null:e.json?e.json():Promise.reject(e):e)(e,t)).catch((e=>h(e,t)));function h(e,t=!0){if(!t)throw e;return(e=>{const t={code:"invalid_json",message:(0,r.__)("The response is not a valid JSON response.")};if(!e||!e.json)throw t;return e.json().catch((()=>{throw t}))})(e).then((e=>{const t={code:"unknown_error",message:(0,r.__)("An unknown error occurred.")};throw e||t}))}const f={Accept:"application/json, */*;q=0.1"},w={credentials:"include"},m=[(e,t)=>("string"!=typeof e.url||(0,a.hasQueryArg)(e.url,"_locale")||(e.url=(0,a.addQueryArgs)(e.url,{_locale:"user"})),"string"!=typeof e.path||(0,a.hasQueryArg)(e.path,"_locale")||(e.path=(0,a.addQueryArgs)(e.path,{_locale:"user"})),t(e)),n,(e,t)=>{const{method:r=u}=e;return p.has(r.toUpperCase())&&(e={...e,headers:{...e.headers,"X-HTTP-Method-Override":r,"Content-Type":"application/json"},method:"POST"}),t(e)},d],g=e=>{if(e.status>=200&&e.status<300)return e;throw e};let y=e=>{const{url:t,path:n,data:o,parse:a=!0,...s}=e;let{body:i,headers:c}=e;return c={...f,...c},o&&(i=JSON.stringify(o),c["Content-Type"]="application/json"),window.fetch(t||n||window.location.href,{...w,...s,body:i,headers:c}).then((e=>Promise.resolve(e).then(g).catch((e=>h(e,a))).then((e=>l(e,a)))),(e=>{if(e&&"AbortError"===e.name)throw e;throw{code:"fetch_error",message:(0,r.__)("You are probably offline.")}}))};function _(e){return m.reduceRight(((e,t)=>r=>t(r,e)),y)(e).catch((t=>"rest_cookie_invalid_nonce"!==t.code?Promise.reject(t):window.fetch(_.nonceEndpoint).then(g).then((e=>e.text())).then((t=>(_.nonceMiddleware.nonce=t,_(e))))))}_.use=function(e){m.unshift(e)},_.setFetchHandler=function(e){y=e},_.createNonceMiddleware=function(e){const t=(e,r)=>{const{headers:n={}}=e;for(const o in n)if("x-wp-nonce"===o.toLowerCase()&&n[o]===t.nonce)return r(e);return r({...e,headers:{...n,"X-WP-Nonce":t.nonce}})};return t.nonce=e,t},_.createPreloadingMiddleware=function(e){const t=Object.keys(e).reduce(((t,r)=>(t[o(r)]=e[r],t)),{});return(e,r)=>{const{parse:n=!0}=e;if("string"==typeof e.path){const r=e.method||"GET",a=o(e.path);if("GET"===r&&t[a]){const e=t[a];return delete t[a],Promise.resolve(n?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}if("OPTIONS"===r&&t[r]&&t[r][a]){const e=t[r][a];return delete t[r][a],Promise.resolve(n?e.body:e)}}return r(e)}},_.createRootURLMiddleware=e=>(t,r)=>n(t,(t=>{let n,o=t.url,a=t.path;return"string"==typeof a&&(n=e,-1!==e.indexOf("?")&&(a=a.replace("?","&")),a=a.replace(/^\//,""),"string"==typeof n&&-1!==n.indexOf("?")&&(a=a.replace("?","&")),o=n+a),r({...t,url:o})})),_.fetchAllMiddleware=d,_.mediaUploadMiddleware=(e,t)=>{if(!function(e){const t=!!e.method&&"POST"===e.method;return(!!e.path&&-1!==e.path.indexOf("/wp/v2/media")||!!e.url&&-1!==e.url.indexOf("/wp/v2/media"))&&t}(e))return t(e);let n=0;const o=e=>(n++,t({path:`/wp/v2/media/${e}/post-process`,method:"POST",data:{action:"create-image-subsizes"},parse:!1}).catch((()=>n<5?o(e):(t({path:`/wp/v2/media/${e}?force=true`,method:"DELETE"}),Promise.reject()))));return t({...e,parse:!1}).catch((t=>{const n=t.headers.get("x-wp-upload-attachment-id");return t.status>=500&&t.status<600&&n?o(n).catch((()=>!1!==e.parse?Promise.reject({code:"post_process",message:(0,r.__)("Media upload failed. If this is a photo or a large image, please scale it down and try again.")}):Promise.reject(t))):h(t,e.parse)})).then((t=>l(t,e.parse)))};var j=_;(window.wp=window.wp||{}).apiFetch=t.default}();
build/block-directory/index.js CHANGED
@@ -1569,7 +1569,7 @@ function InstallButton({
1569
  const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name);
1570
  const [originalBlock] = (0,external_wp_blocks_namespaceObject.parse)(attributes.originalContent);
1571
 
1572
- if (originalBlock) {
1573
  replaceBlock(clientId, (0,external_wp_blocks_namespaceObject.createBlock)(blockType.name, originalBlock.attributes, originalBlock.innerBlocks));
1574
  }
1575
  }
1569
  const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name);
1570
  const [originalBlock] = (0,external_wp_blocks_namespaceObject.parse)(attributes.originalContent);
1571
 
1572
+ if (originalBlock && blockType) {
1573
  replaceBlock(clientId, (0,external_wp_blocks_namespaceObject.createBlock)(blockType.name, originalBlock.attributes, originalBlock.innerBlocks));
1574
  }
1575
  }
build/block-directory/index.min.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'wp-a11y', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives'), 'version' => '992e3fec0ab35bbf35df6b0db8f6f5ae');
1
+ <?php return array('dependencies' => array('lodash', 'wp-a11y', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-notices', 'wp-plugins', 'wp-polyfill', 'wp-primitives'), 'version' => 'a16899f95e4f1e34d74b9580ea581045');
build/block-directory/index.min.js CHANGED
@@ -10,7 +10,7 @@
10
  (0,v._n)("%d additional block is available to install.","%d additional blocks are available to install.",n),n))}),[n]),(0,r.createElement)(r.Fragment,null,!l&&(0,r.createElement)("p",{className:"block-directory-downloadable-blocks-panel__no-local"},(0,v.__)("No results available from your installed blocks.")),(0,r.createElement)("div",{className:"block-editor-inserter__quick-inserter-separator"}),(0,r.createElement)("div",{className:"block-directory-downloadable-blocks-panel"},(0,r.createElement)("div",{className:"block-directory-downloadable-blocks-panel__header"},(0,r.createElement)("h2",{className:"block-directory-downloadable-blocks-panel__title"},(0,v.__)("Available to install")),(0,r.createElement)("p",{className:"block-directory-downloadable-blocks-panel__description"},(0,v.__)("Select a block to install and add it to your post."))),e))},se=(0,r.createElement)(G.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(G.Path,{d:"M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"})),ie=function(){return(0,r.createElement)("div",{className:"block-editor-inserter__no-results"},(0,r.createElement)(q,{className:"block-editor-inserter__no-results-icon",icon:se}),(0,r.createElement)("p",null,(0,v.__)("No results found.")))},ce=(0,z.compose)([(0,c.withSelect)(((e,{filterValue:t,rootClientId:l=null})=>{const{getDownloadableBlocks:n,isRequestingDownloadableBlocks:o}=e(x),{canInsertBlockType:r}=e(p.store),a=e(U.store).canUser("read","block-directory/search");return{downloadableItems:a?n(t).filter((e=>r(e,l,!0))):[],hasPermission:a,isLoading:o(t)}}))])((function({downloadableItems:e,onSelect:t,onHover:l,hasLocalBlocks:n,hasPermission:o,isLoading:a,isTyping:s}){return void 0===o||a||s?(0,r.createElement)(r.Fragment,null,o&&!n&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("p",{className:"block-directory-downloadable-blocks-panel__no-local"},(0,v.__)("No results available from your installed blocks.")),(0,r.createElement)("div",{className:"block-editor-inserter__quick-inserter-separator"})),(0,r.createElement)("div",{className:"block-directory-downloadable-blocks-panel has-blocks-loading"},(0,r.createElement)(K.Spinner,null))):!1===o?n?null:(0,r.createElement)(ie,null):e.length?(0,r.createElement)(ae,{downloadableItems:e,hasLocalBlocks:n},(0,r.createElement)(oe,{items:e,onSelect:t,onHover:l})):!n&&(0,r.createElement)(ie,null)})),de=function(){const[e,t]=(0,r.useState)(""),l=(0,u.debounce)(t,400);return(0,r.createElement)(p.__unstableInserterMenuExtension,null,(({onSelect:t,onHover:n,filterValue:o,hasItems:a,rootClientId:s})=>(e!==o&&l(o),e?(0,r.createElement)(ce,{onSelect:t,onHover:n,rootClientId:s,filterValue:e,hasLocalBlocks:a,isTyping:o!==e}):null)))},ue=window.wp.editPost;function me({items:e}){return e.length?(0,r.createElement)("ul",{className:"block-directory-compact-list"},e.map((({icon:e,id:t,title:l,author:n})=>(0,r.createElement)("li",{key:t,className:"block-directory-compact-list__item"},(0,r.createElement)(ee,{icon:e,title:l}),(0,r.createElement)("div",{className:"block-directory-compact-list__item-details"},(0,r.createElement)("div",{className:"block-directory-compact-list__item-title"},l),(0,r.createElement)("div",{className:"block-directory-compact-list__item-author"},(0,v.sprintf)(
11
  /* translators: %s: Name of the block author. */
12
  (0,v.__)("By %s"),n))))))):null}function pe(){const e=(0,c.useSelect)((e=>e(x).getNewBlockTypes()),[]);return e.length?(0,r.createElement)(ue.PluginPrePublishPanel,{icon:se,title:(0,v.sprintf)(// translators: %d: number of blocks (number).
13
- (0,v._n)("Added: %d block","Added: %d blocks",e.length),e.length),initialOpen:!0},(0,r.createElement)("p",{className:"installed-blocks-pre-publish-panel__copy"},(0,v._n)("The following block has been added to your site.","The following blocks have been added to your site.",e.length)),(0,r.createElement)(me,{items:e})):null}function ke({attributes:e,block:t,clientId:l}){const n=(0,c.useSelect)((e=>e(x).isInstalling(t.id)),[t.id]),{installBlockType:o}=(0,c.useDispatch)(x),{replaceBlock:a}=(0,c.useDispatch)(p.store);return(0,r.createElement)(K.Button,{onClick:()=>o(t).then((n=>{if(n){const n=(0,i.getBlockType)(t.name),[o]=(0,i.parse)(e.originalContent);o&&a(l,(0,i.createBlock)(n.name,o.attributes,o.innerBlocks))}})),disabled:n,isBusy:n,variant:"primary"},(0,v.sprintf)(
14
  /* translators: %s: block name */
15
  (0,v.__)("Install %s"),t.title))}const be=({originalBlock:e,...t})=>{const{originalName:l,originalUndelimitedContent:n}=t.attributes,{replaceBlock:o}=(0,c.useDispatch)(p.store),a=!!n,s=(0,i.getBlockType)("core/html");let d=(0,v.sprintf)(
16
  /* translators: %s: block name */
10
  (0,v._n)("%d additional block is available to install.","%d additional blocks are available to install.",n),n))}),[n]),(0,r.createElement)(r.Fragment,null,!l&&(0,r.createElement)("p",{className:"block-directory-downloadable-blocks-panel__no-local"},(0,v.__)("No results available from your installed blocks.")),(0,r.createElement)("div",{className:"block-editor-inserter__quick-inserter-separator"}),(0,r.createElement)("div",{className:"block-directory-downloadable-blocks-panel"},(0,r.createElement)("div",{className:"block-directory-downloadable-blocks-panel__header"},(0,r.createElement)("h2",{className:"block-directory-downloadable-blocks-panel__title"},(0,v.__)("Available to install")),(0,r.createElement)("p",{className:"block-directory-downloadable-blocks-panel__description"},(0,v.__)("Select a block to install and add it to your post."))),e))},se=(0,r.createElement)(G.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)(G.Path,{d:"M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"})),ie=function(){return(0,r.createElement)("div",{className:"block-editor-inserter__no-results"},(0,r.createElement)(q,{className:"block-editor-inserter__no-results-icon",icon:se}),(0,r.createElement)("p",null,(0,v.__)("No results found.")))},ce=(0,z.compose)([(0,c.withSelect)(((e,{filterValue:t,rootClientId:l=null})=>{const{getDownloadableBlocks:n,isRequestingDownloadableBlocks:o}=e(x),{canInsertBlockType:r}=e(p.store),a=e(U.store).canUser("read","block-directory/search");return{downloadableItems:a?n(t).filter((e=>r(e,l,!0))):[],hasPermission:a,isLoading:o(t)}}))])((function({downloadableItems:e,onSelect:t,onHover:l,hasLocalBlocks:n,hasPermission:o,isLoading:a,isTyping:s}){return void 0===o||a||s?(0,r.createElement)(r.Fragment,null,o&&!n&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("p",{className:"block-directory-downloadable-blocks-panel__no-local"},(0,v.__)("No results available from your installed blocks.")),(0,r.createElement)("div",{className:"block-editor-inserter__quick-inserter-separator"})),(0,r.createElement)("div",{className:"block-directory-downloadable-blocks-panel has-blocks-loading"},(0,r.createElement)(K.Spinner,null))):!1===o?n?null:(0,r.createElement)(ie,null):e.length?(0,r.createElement)(ae,{downloadableItems:e,hasLocalBlocks:n},(0,r.createElement)(oe,{items:e,onSelect:t,onHover:l})):!n&&(0,r.createElement)(ie,null)})),de=function(){const[e,t]=(0,r.useState)(""),l=(0,u.debounce)(t,400);return(0,r.createElement)(p.__unstableInserterMenuExtension,null,(({onSelect:t,onHover:n,filterValue:o,hasItems:a,rootClientId:s})=>(e!==o&&l(o),e?(0,r.createElement)(ce,{onSelect:t,onHover:n,rootClientId:s,filterValue:e,hasLocalBlocks:a,isTyping:o!==e}):null)))},ue=window.wp.editPost;function me({items:e}){return e.length?(0,r.createElement)("ul",{className:"block-directory-compact-list"},e.map((({icon:e,id:t,title:l,author:n})=>(0,r.createElement)("li",{key:t,className:"block-directory-compact-list__item"},(0,r.createElement)(ee,{icon:e,title:l}),(0,r.createElement)("div",{className:"block-directory-compact-list__item-details"},(0,r.createElement)("div",{className:"block-directory-compact-list__item-title"},l),(0,r.createElement)("div",{className:"block-directory-compact-list__item-author"},(0,v.sprintf)(
11
  /* translators: %s: Name of the block author. */
12
  (0,v.__)("By %s"),n))))))):null}function pe(){const e=(0,c.useSelect)((e=>e(x).getNewBlockTypes()),[]);return e.length?(0,r.createElement)(ue.PluginPrePublishPanel,{icon:se,title:(0,v.sprintf)(// translators: %d: number of blocks (number).
13
+ (0,v._n)("Added: %d block","Added: %d blocks",e.length),e.length),initialOpen:!0},(0,r.createElement)("p",{className:"installed-blocks-pre-publish-panel__copy"},(0,v._n)("The following block has been added to your site.","The following blocks have been added to your site.",e.length)),(0,r.createElement)(me,{items:e})):null}function ke({attributes:e,block:t,clientId:l}){const n=(0,c.useSelect)((e=>e(x).isInstalling(t.id)),[t.id]),{installBlockType:o}=(0,c.useDispatch)(x),{replaceBlock:a}=(0,c.useDispatch)(p.store);return(0,r.createElement)(K.Button,{onClick:()=>o(t).then((n=>{if(n){const n=(0,i.getBlockType)(t.name),[o]=(0,i.parse)(e.originalContent);o&&n&&a(l,(0,i.createBlock)(n.name,o.attributes,o.innerBlocks))}})),disabled:n,isBusy:n,variant:"primary"},(0,v.sprintf)(
14
  /* translators: %s: block name */
15
  (0,v.__)("Install %s"),t.title))}const be=({originalBlock:e,...t})=>{const{originalName:l,originalUndelimitedContent:n}=t.attributes,{replaceBlock:o}=(0,c.useDispatch)(p.store),a=!!n,s=(0,i.getBlockType)("core/html");let d=(0,v.sprintf)(
16
  /* translators: %s: block name */
build/block-editor/index.js CHANGED
@@ -2235,8 +2235,6 @@ __webpack_require__.d(__webpack_exports__, {
2235
  "__experimentalLinkControlSearchItem": function() { return /* reexport */ search_item; },
2236
  "__experimentalLinkControlSearchResults": function() { return /* reexport */ LinkControlSearchResults; },
2237
  "__experimentalListView": function() { return /* reexport */ components_list_view; },
2238
- "__experimentalListViewBlockFill": function() { return /* reexport */ ListViewBlockFill; },
2239
- "__experimentalListViewEditor": function() { return /* reexport */ ListViewEditor; },
2240
  "__experimentalPanelColorGradientSettings": function() { return /* reexport */ panel_color_gradient_settings; },
2241
  "__experimentalPreviewOptions": function() { return /* reexport */ PreviewOptions; },
2242
  "__experimentalResponsiveBlockControl": function() { return /* reexport */ responsive_block_control; },
@@ -3065,7 +3063,17 @@ const withBlockTree = reducer => (state = {}, action) => {
3065
  const subTree = buildBlockTree(newState, action.blocks);
3066
  newState.tree = updateParentInnerBlocksInTree(newState, { ...(0,external_lodash_namespaceObject.omit)(newState.tree, action.replacedClientIds.concat(action.replacedClientIds.map(clientId => 'controlled||' + clientId))),
3067
  ...subTree
3068
- }, action.blocks.map(b => b.clientId));
 
 
 
 
 
 
 
 
 
 
3069
  break;
3070
  }
3071
 
@@ -6127,9 +6135,7 @@ const buildBlockTypeItem = (state, {
6127
  frecency: calculateFrecency(time, count)
6128
  };
6129
  if (buildScope === 'transform') return blockItemBase;
6130
- const inserterVariations = blockType.variations.filter(({
6131
- scope
6132
- }) => !scope || scope.includes('inserter'));
6133
  return { ...blockItemBase,
6134
  initialAttributes: {},
6135
  description: blockType.description,
@@ -8888,9 +8894,12 @@ function Icon({
8888
 
8889
  if (hasBlockGapStylesSupport) {
8890
  style += `
 
 
 
 
8891
  ${appendSelectors(selector, '> * + *')} {
8892
  margin-top: var( --wp--style--block-gap );
8893
- margin-bottom: 0;
8894
  }
8895
  `;
8896
  }
@@ -9073,7 +9082,7 @@ const WIDE_CONTROLS = ['wide', 'full'];
9073
  function useAvailableAlignments(controls = DEFAULT_CONTROLS) {
9074
  // Always add the `none` option if not exists.
9075
  if (!controls.includes('none')) {
9076
- controls.unshift('none');
9077
  }
9078
 
9079
  const {
@@ -9094,9 +9103,16 @@ function useAvailableAlignments(controls = DEFAULT_CONTROLS) {
9094
  const layoutAlignments = layoutType.getAlignments(layout);
9095
 
9096
  if (themeSupportsLayout) {
9097
- return layoutAlignments.filter(({
9098
  name: alignmentName
9099
- }) => controls.includes(alignmentName));
 
 
 
 
 
 
 
9100
  } // Starting here, it's the fallback for themes not supporting the layout config.
9101
 
9102
 
@@ -9110,7 +9126,13 @@ function useAvailableAlignments(controls = DEFAULT_CONTROLS) {
9110
  const enabledControls = controls.filter(control => (layout.alignments || // Ignore the global wideAlignment check if the layout explicitely defines alignments.
9111
  wideControlsEnabled || !WIDE_CONTROLS.includes(control)) && availableAlignments.includes(control)).map(enabledControl => ({
9112
  name: enabledControl
9113
- }));
 
 
 
 
 
 
9114
  return enabledControls;
9115
  }
9116
  //# sourceMappingURL=use-available-alignments.js.map
@@ -9324,7 +9346,7 @@ function getValidAlignments(blockAlign, hasWideBlockSupport = true, hasWideEnabl
9324
  validAlignments = ALL_ALIGNMENTS.filter(value => blockAlign.includes(value));
9325
  } else if (blockAlign === true) {
9326
  // `true` includes all alignments...
9327
- validAlignments = ALL_ALIGNMENTS;
9328
  } else {
9329
  validAlignments = [];
9330
  }
@@ -9375,12 +9397,15 @@ function addAttribute(settings) {
9375
  const withToolbarControls = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => {
9376
  const {
9377
  name: blockName
9378
- } = props; // Compute the block allowed alignments without taking into account,
9379
- // if the theme supports wide alignments or not
9380
- // and without checking the layout for availble alignments.
9381
- // BlockAlignmentToolbar takes both of these into account.
9382
 
9383
  const blockAllowedAlignments = getValidAlignments((0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, 'align'), (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'alignWide', true));
 
 
 
9384
 
9385
  const updateAlignment = nextAlign => {
9386
  if (!nextAlign) {
@@ -9399,13 +9424,13 @@ const withToolbarControls = (0,external_wp_compose_namespaceObject.createHigherO
9399
  });
9400
  };
9401
 
9402
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, blockAllowedAlignments.length > 0 && (0,external_wp_element_namespaceObject.createElement)(block_controls, {
9403
  group: "block",
9404
  __experimentalShareWithChildBlocks: true
9405
  }, (0,external_wp_element_namespaceObject.createElement)(BlockAlignmentControl, {
9406
  value: props.attributes.align,
9407
  onChange: updateAlignment,
9408
- controls: blockAllowedAlignments
9409
  })), (0,external_wp_element_namespaceObject.createElement)(BlockEdit, props));
9410
  }, 'withToolbarControls');
9411
  /**
@@ -9532,11 +9557,16 @@ const groups_groups = {
9532
  ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inspector-controls/fill.js
9533
 
9534
 
 
 
 
 
9535
  /**
9536
  * WordPress dependencies
9537
  */
9538
 
9539
 
 
9540
  /**
9541
  * Internal dependencies
9542
  */
@@ -9563,7 +9593,16 @@ function InspectorControlsFill({
9563
 
9564
  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalStyleProvider, {
9565
  document: document
9566
- }, (0,external_wp_element_namespaceObject.createElement)(Fill, null, children));
 
 
 
 
 
 
 
 
 
9567
  }
9568
  //# sourceMappingURL=fill.js.map
9569
  ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/utils.js
@@ -9603,8 +9642,8 @@ const cleanEmptyObject = object => {
9603
 
9604
  function BlockSupportToolsPanel({
9605
  children,
9606
- label,
9607
- header
9608
  }) {
9609
  const {
9610
  clientId,
@@ -9644,14 +9683,36 @@ function BlockSupportToolsPanel({
9644
  };
9645
 
9646
  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, {
 
9647
  label: label,
9648
- header: header,
9649
  resetAll: resetAll,
9650
  key: clientId,
9651
- panelId: clientId
 
 
 
9652
  }, children);
9653
  }
9654
  //# sourceMappingURL=block-support-tools-panel.js.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9655
  ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inspector-controls/slot.js
9656
 
9657
 
@@ -9667,6 +9728,7 @@ function BlockSupportToolsPanel({
9667
 
9668
 
9669
 
 
9670
  function InspectorControlsSlot({
9671
  __experimentalGroup: group = 'default',
9672
  bubblesVirtually = true,
@@ -9693,8 +9755,9 @@ function InspectorControlsSlot({
9693
  return (0,external_wp_element_namespaceObject.createElement)(BlockSupportToolsPanel, {
9694
  group: group,
9695
  label: label
9696
- }, (0,external_wp_element_namespaceObject.createElement)(Slot, _extends({}, props, {
9697
- bubblesVirtually: bubblesVirtually
 
9698
  })));
9699
  }
9700
 
@@ -9811,7 +9874,7 @@ const withInspectorControl = (0,external_wp_compose_namespaceObject.createHigher
9811
  className: "html-anchor-control",
9812
  label: (0,external_wp_i18n_namespaceObject.__)('HTML anchor'),
9813
  help: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.'), isWeb && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
9814
- href: 'https://wordpress.org/support/article/page-jumps/'
9815
  }, (0,external_wp_i18n_namespaceObject.__)('Learn more about anchors'))),
9816
  value: props.attributes.anchor || '',
9817
  placeholder: !isWeb ? (0,external_wp_i18n_namespaceObject.__)('Add an anchor') : null,
@@ -9994,4753 +10057,4897 @@ function addGeneratedClassName(extraProps, blockType) {
9994
  }
9995
  (0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/generated-class-name/save-props', addGeneratedClassName);
9996
  //# sourceMappingURL=generated-class-name.js.map
9997
- ;// CONCATENATED MODULE: ./packages/block-editor/node_modules/colord/index.mjs
9998
- var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n<t.length;n++){var e=t[n][0](r);if(e)return[e,t[n][1]]}return[null,void 0]},x=function(r){return"string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},I=function(r){return x(r)[1]},M=function(r,t){var n=c(r);return{h:n.h,s:e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return{h:n.h,s:n.s,l:e(n.l+100*t,0,100),a:n.a}},j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return"number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return"number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof j?r:new j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(j,y),S.push(r))})},E=function(){return new j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};
9999
-
10000
- ;// CONCATENATED MODULE: ./packages/block-editor/node_modules/colord/plugins/names.mjs
10001
- /* harmony default export */ function names(e,f){var a={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var d in a)r[a[d]]=d;var l={};e.prototype.toName=function(f){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var d,i,n=r[this.toHex()];if(n)return n;if(null==f?void 0:f.closest){var o=this.toRgb(),t=1/0,b="black";if(!l.length)for(var c in a)l[c]=new e(a[c]).toRgb();for(var g in a){var u=(d=o,i=l[g],Math.pow(d.r-i.r,2)+Math.pow(d.g-i.g,2)+Math.pow(d.b-i.b,2));u<t&&(t=u,b=g)}return b}};f.string.push([function(f){var r=f.toLowerCase(),d="transparent"===r?"#0000":a[r];return d?new e(d).toRgb():null},"name"])}
10002
 
10003
- ;// CONCATENATED MODULE: ./packages/block-editor/node_modules/colord/plugins/a11y.mjs
10004
- var a11y_o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},a11y_t=function(t){return.2126*a11y_o(t.r)+.7152*a11y_o(t.g)+.0722*a11y_o(t.b)};/* harmony default export */ function a11y(o){o.prototype.luminance=function(){return o=a11y_t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,a,i,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=a11y_t(e),d=a11y_t(v),n=u>d?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(a=2)&&(a=0),void 0===i&&(i=Math.pow(10,a)),Math.floor(i*n)/i+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(i=(r=t).size)?"normal":i,"AAA"===(a=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===a&&"large"===e?3:4.5);var r,n,a,i,e}}
10005
 
10006
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/colors/utils.js
10007
  /**
10008
- * External dependencies
10009
  */
10010
 
 
10011
 
10012
-
10013
-
10014
- k([names, a11y]);
10015
  /**
10016
- * Provided an array of color objects as set by the theme or by the editor defaults,
10017
- * and the values of the defined color or custom color returns a color object describing the color.
10018
- *
10019
- * @param {Array} colors Array of color objects as set by the theme or by the editor defaults.
10020
- * @param {?string} definedColor A string containing the color slug.
10021
- * @param {?string} customColor A string containing the customColor value.
10022
  *
10023
- * @return {?Object} If definedColor is passed and the name is found in colors,
10024
- * the color object exactly as set by the theme or editor defaults is returned.
10025
- * Otherwise, an object that just sets the color is defined.
10026
  */
10027
 
10028
- const getColorObjectByAttributeValues = (colors, definedColor, customColor) => {
10029
- if (definedColor) {
10030
- const colorObj = (0,external_lodash_namespaceObject.find)(colors, {
10031
- slug: definedColor
10032
- });
10033
-
10034
- if (colorObj) {
10035
- return colorObj;
10036
- }
10037
- }
10038
 
10039
- return {
10040
- color: customColor
10041
- };
10042
- };
10043
  /**
10044
- * Provided an array of color objects as set by the theme or by the editor defaults, and a color value returns the color object matching that value or undefined.
10045
  *
10046
- * @param {Array} colors Array of color objects as set by the theme or by the editor defaults.
10047
- * @param {?string} colorValue A string containing the color value.
10048
  *
10049
- * @return {?Object} Color object included in the colors array whose color property equals colorValue.
10050
- * Returns undefined if no color object matches this requirement.
10051
  */
10052
 
10053
- const getColorObjectByColorValue = (colors, colorValue) => {
10054
- return (0,external_lodash_namespaceObject.find)(colors, {
10055
- color: colorValue
 
 
 
 
 
 
 
 
10056
  });
10057
- };
10058
- /**
10059
- * Returns a class based on the context a color is being used and its slug.
10060
- *
10061
- * @param {string} colorContextName Context/place where color is being used e.g: background, text etc...
10062
- * @param {string} colorSlug Slug of the color.
10063
- *
10064
- * @return {?string} String with the class corresponding to the color in the provided context.
10065
- * Returns undefined if either colorContextName or colorSlug are not provided.
10066
- */
10067
 
10068
- function getColorClassName(colorContextName, colorSlug) {
10069
- if (!colorContextName || !colorSlug) {
10070
- return undefined;
10071
- }
10072
 
10073
- return `has-${(0,external_lodash_namespaceObject.kebabCase)(colorSlug)}-${colorContextName}`;
10074
- }
10075
- /**
10076
- * Given an array of color objects and a color value returns the color value of the most readable color in the array.
10077
- *
10078
- * @param {Array} colors Array of color objects as set by the theme or by the editor defaults.
10079
- * @param {?string} colorValue A string containing the color value.
10080
- *
10081
- * @return {string} String with the color value of the most readable color.
10082
- */
10083
 
10084
- function getMostReadableColor(colors, colorValue) {
10085
- const colordColor = w(colorValue);
10086
- return (0,external_lodash_namespaceObject.maxBy)(colors, ({
10087
- color
10088
- }) => colordColor.contrast(color)).color;
10089
- }
10090
- //# sourceMappingURL=utils.js.map
10091
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/gradients/use-gradient.js
10092
  /**
10093
  * External dependencies
10094
  */
10095
 
 
10096
  /**
10097
  * WordPress dependencies
10098
  */
10099
 
10100
 
10101
 
 
10102
  /**
10103
  * Internal dependencies
10104
  */
10105
 
10106
 
10107
-
10108
-
10109
- const use_gradient_EMPTY_ARRAY = [];
10110
- function __experimentalGetGradientClass(gradientSlug) {
10111
- if (!gradientSlug) {
10112
- return undefined;
10113
- }
10114
-
10115
- return `has-${gradientSlug}-gradient-background`;
10116
- }
10117
- /**
10118
- * Retrieves the gradient value per slug.
10119
- *
10120
- * @param {Array} gradients Gradient Palette
10121
- * @param {string} slug Gradient slug
10122
- *
10123
- * @return {string} Gradient value.
10124
- */
10125
-
10126
- function getGradientValueBySlug(gradients, slug) {
10127
- const gradient = (0,external_lodash_namespaceObject.find)(gradients, ['slug', slug]);
10128
- return gradient && gradient.gradient;
10129
- }
10130
- function __experimentalGetGradientObjectByGradientValue(gradients, value) {
10131
- const gradient = (0,external_lodash_namespaceObject.find)(gradients, ['gradient', value]);
10132
- return gradient;
10133
- }
10134
  /**
10135
- * Retrieves the gradient slug per slug.
 
 
 
10136
  *
10137
- * @param {Array} gradients Gradient Palette
10138
- * @param {string} value Gradient value
10139
- * @return {string} Gradient slug.
10140
  */
10141
 
10142
- function getGradientSlugByValue(gradients, value) {
10143
- const gradient = __experimentalGetGradientObjectByGradientValue(gradients, value);
10144
-
10145
- return gradient && gradient.slug;
10146
- }
10147
- function __experimentalUseGradient({
10148
- gradientAttribute = 'gradient',
10149
- customGradientAttribute = 'customGradient'
10150
- } = {}) {
10151
- const {
10152
- clientId
10153
- } = useBlockEditContext();
10154
- const gradients = useSetting('color.gradients') || use_gradient_EMPTY_ARRAY;
10155
- const {
10156
- gradient,
10157
- customGradient
10158
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
10159
- const {
10160
- getBlockAttributes
10161
- } = select(store);
10162
- const attributes = getBlockAttributes(clientId) || {};
10163
- return {
10164
- customGradient: attributes[customGradientAttribute],
10165
- gradient: attributes[gradientAttribute]
10166
- };
10167
- }, [clientId, gradientAttribute, customGradientAttribute]);
10168
  const {
10169
- updateBlockAttributes
10170
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
10171
- const setGradient = (0,external_wp_element_namespaceObject.useCallback)(newGradientValue => {
10172
- const slug = getGradientSlugByValue(gradients, newGradientValue);
 
10173
 
10174
- if (slug) {
10175
- updateBlockAttributes(clientId, {
10176
- [gradientAttribute]: slug,
10177
- [customGradientAttribute]: undefined
10178
- });
10179
- return;
10180
- }
10181
 
10182
- updateBlockAttributes(clientId, {
10183
- [gradientAttribute]: undefined,
10184
- [customGradientAttribute]: newGradientValue
10185
- });
10186
- }, [gradients, clientId, updateBlockAttributes]);
10187
 
10188
- const gradientClass = __experimentalGetGradientClass(gradient);
10189
 
10190
- let gradientValue;
10191
 
10192
- if (gradient) {
10193
- gradientValue = getGradientValueBySlug(gradients, gradient);
10194
- } else {
10195
- gradientValue = customGradient;
10196
- }
10197
 
10198
- return {
10199
- gradientClass,
10200
- gradientValue,
10201
- setGradient
10202
- };
10203
- }
10204
- //# sourceMappingURL=use-gradient.js.map
10205
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/colors-gradients/control.js
10206
 
 
 
 
 
 
 
 
 
 
 
10207
 
10208
 
10209
  /**
10210
- * External dependencies
10211
  */
10212
 
10213
-
10214
  /**
10215
- * WordPress dependencies
10216
  */
10217
 
10218
 
10219
 
10220
 
10221
- /**
10222
- * Internal dependencies
10223
- */
10224
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10225
 
10226
 
10227
- // translators: first %s: the color name or value (e.g. red or #ff0000)
 
 
10228
 
10229
- const colorIndicatorAriaLabel = (0,external_wp_i18n_namespaceObject.__)('(Color: %s)'); // translators: first %s: the gradient name or value (e.g. red to green or linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)
 
 
 
 
 
 
 
 
10230
 
10231
 
10232
- const gradientIndicatorAriaLabel = (0,external_wp_i18n_namespaceObject.__)('(Gradient: %s)');
 
 
10233
 
10234
- const colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients'];
 
 
10235
 
10236
- function VisualLabel({
10237
- colors,
10238
- gradients,
10239
- label,
10240
- currentTab,
10241
- colorValue,
10242
- gradientValue
10243
- }) {
10244
- let value, ariaLabel;
10245
 
10246
- if (currentTab === 'color') {
10247
- if (colorValue) {
10248
- value = colorValue;
10249
- const colorObject = getColorObjectByColorValue(colors, value);
10250
- const colorName = colorObject && colorObject.name;
10251
- ariaLabel = (0,external_wp_i18n_namespaceObject.sprintf)(colorIndicatorAriaLabel, colorName || value);
10252
- }
10253
- } else if (currentTab === 'gradient' && gradientValue) {
10254
- value = gradientValue;
10255
 
10256
- const gradientObject = __experimentalGetGradientObjectByGradientValue(gradients, value);
10257
 
10258
- const gradientName = gradientObject && gradientObject.name;
10259
- ariaLabel = (0,external_wp_i18n_namespaceObject.sprintf)(gradientIndicatorAriaLabel, gradientName || value);
10260
- }
10261
 
10262
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, label, !!value && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
10263
- colorValue: value,
10264
- "aria-label": ariaLabel
10265
- }));
10266
- }
10267
 
10268
- function ColorGradientControlInner({
10269
- colors,
10270
- gradients,
10271
- disableCustomColors,
10272
- disableCustomGradients,
10273
  className,
10274
- label,
10275
- onColorChange,
10276
- onGradientChange,
10277
- colorValue,
10278
- gradientValue,
10279
- clearable
10280
  }) {
10281
- const canChooseAColor = onColorChange && (!(0,external_lodash_namespaceObject.isEmpty)(colors) || !disableCustomColors);
10282
- const canChooseAGradient = onGradientChange && (!(0,external_lodash_namespaceObject.isEmpty)(gradients) || !disableCustomGradients);
10283
- const [currentTab, setCurrentTab] = (0,external_wp_element_namespaceObject.useState)(gradientValue ? 'gradient' : !!canChooseAColor && 'color');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10284
 
10285
- if (!canChooseAColor && !canChooseAGradient) {
10286
- return null;
10287
- }
10288
 
10289
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, {
10290
- className: classnames_default()('block-editor-color-gradient-control', className)
10291
- }, (0,external_wp_element_namespaceObject.createElement)("fieldset", null, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_element_namespaceObject.createElement)("div", {
10292
- className: "block-editor-color-gradient-control__color-indicator"
10293
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl.VisualLabel, null, (0,external_wp_element_namespaceObject.createElement)(VisualLabel, {
10294
- currentTab: currentTab,
10295
- label: label,
10296
- colorValue: colorValue,
10297
- gradientValue: gradientValue
10298
- })))), canChooseAColor && canChooseAGradient && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ButtonGroup, {
10299
- className: "block-editor-color-gradient-control__button-tabs"
10300
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
10301
- isSmall: true,
10302
- isPressed: currentTab === 'color',
10303
- onClick: () => setCurrentTab('color')
10304
- }, (0,external_wp_i18n_namespaceObject.__)('Solid')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
10305
- isSmall: true,
10306
- isPressed: currentTab === 'gradient',
10307
- onClick: () => setCurrentTab('gradient')
10308
- }, (0,external_wp_i18n_namespaceObject.__)('Gradient'))), (currentTab === 'color' || !canChooseAGradient) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorPalette, {
10309
- value: colorValue,
10310
- onChange: canChooseAGradient ? newColor => {
10311
- onColorChange(newColor);
10312
- onGradientChange();
10313
- } : onColorChange,
10314
- colors,
10315
- disableCustomColors,
10316
- clearable: clearable
10317
- }), (currentTab === 'gradient' || !canChooseAColor) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.GradientPicker, {
10318
- value: gradientValue,
10319
- onChange: canChooseAColor ? newGradient => {
10320
- onGradientChange(newGradient);
10321
- onColorChange();
10322
- } : onGradientChange,
10323
- gradients,
10324
- disableCustomGradients,
10325
- clearable: clearable
10326
- })));
10327
- }
10328
 
10329
- function ColorGradientControlSelect(props) {
10330
- const colorGradientSettings = {};
10331
- colorGradientSettings.colors = useSetting('color.palette');
10332
- colorGradientSettings.gradients = useSetting('color.gradients');
10333
- colorGradientSettings.disableCustomColors = !useSetting('color.custom');
10334
- colorGradientSettings.disableCustomGradients = !useSetting('color.customGradient');
10335
- return (0,external_wp_element_namespaceObject.createElement)(ColorGradientControlInner, _extends({}, colorGradientSettings, props));
10336
- }
10337
 
10338
- function ColorGradientControl(props) {
10339
- if ((0,external_lodash_namespaceObject.every)(colorsAndGradientKeys, key => props.hasOwnProperty(key))) {
10340
- return (0,external_wp_element_namespaceObject.createElement)(ColorGradientControlInner, props);
10341
- }
10342
 
10343
- return (0,external_wp_element_namespaceObject.createElement)(ColorGradientControlSelect, props);
10344
- }
10345
 
10346
- /* harmony default export */ var control = (ColorGradientControl);
10347
- //# sourceMappingURL=control.js.map
10348
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/border-color.js
10349
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10350
 
10351
 
10352
  /**
10353
  * External dependencies
10354
  */
10355
 
 
 
 
 
10356
  /**
10357
  * WordPress dependencies
10358
  */
10359
 
10360
 
10361
 
10362
-
10363
-
10364
  /**
10365
  * Internal dependencies
10366
  */
10367
 
10368
 
10369
 
10370
-
10371
-
10372
- // Defining empty array here instead of inline avoids unnecessary re-renders of
10373
- // color control.
10374
-
10375
- const border_color_EMPTY_ARRAY = [];
10376
- /**
10377
- * Inspector control panel containing the border color related configuration.
10378
- *
10379
- * There is deliberate overlap between the colors and borders block supports
10380
- * relating to border color. It can be argued the border color controls could
10381
- * be included within either, or both, the colors and borders panels in the
10382
- * inspector controls. If they share the same block attributes it should not
10383
- * matter.
10384
- *
10385
- * @param {Object} props Block properties.
10386
- *
10387
- * @return {WPElement} Border color edit element.
10388
- */
10389
-
10390
- function BorderColorEdit(props) {
10391
- const {
10392
- attributes: {
10393
- borderColor,
10394
- style
10395
- },
10396
- setAttributes
10397
- } = props;
10398
- const colors = useSetting('color.palette') || border_color_EMPTY_ARRAY;
10399
- const disableCustomColors = !useSetting('color.custom');
10400
- const disableCustomGradients = !useSetting('color.customGradient');
10401
- const [colorValue, setColorValue] = (0,external_wp_element_namespaceObject.useState)(() => {
10402
- var _getColorObjectByAttr, _style$border;
10403
-
10404
- return (_getColorObjectByAttr = getColorObjectByAttributeValues(colors, borderColor, style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.color)) === null || _getColorObjectByAttr === void 0 ? void 0 : _getColorObjectByAttr.color;
10405
- });
10406
-
10407
- const onChangeColor = value => {
10408
- setColorValue(value);
10409
- const colorObject = getColorObjectByColorValue(colors, value);
10410
- const newStyle = { ...style,
10411
- border: { ...(style === null || style === void 0 ? void 0 : style.border),
10412
- color: colorObject !== null && colorObject !== void 0 && colorObject.slug ? undefined : value
10413
- }
10414
- }; // If empty slug, ensure undefined to remove attribute.
10415
-
10416
- const newNamedColor = colorObject !== null && colorObject !== void 0 && colorObject.slug ? colorObject.slug : undefined;
10417
- setAttributes({
10418
- style: cleanEmptyObject(newStyle),
10419
- borderColor: newNamedColor
10420
  });
10421
- };
10422
 
10423
- return (0,external_wp_element_namespaceObject.createElement)(control, {
10424
- label: (0,external_wp_i18n_namespaceObject.__)('Color'),
10425
- colorValue: colorValue,
10426
- colors: colors,
10427
- gradients: undefined,
10428
- disableCustomColors: disableCustomColors,
10429
- disableCustomGradients: disableCustomGradients,
10430
- onColorChange: onChangeColor
10431
- });
10432
- }
10433
- /**
10434
- * Filters registered block settings, extending attributes to include
10435
- * `borderColor` if needed.
10436
- *
10437
- * @param {Object} settings Original block settings.
10438
- *
10439
- * @return {Object} Updated block settings.
10440
- */
10441
 
10442
- function addAttributes(settings) {
10443
- if (!hasBorderSupport(settings, 'color')) {
10444
- return settings;
10445
- } // Allow blocks to specify default value if needed.
10446
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10447
 
10448
- if (settings.attributes.borderColor) {
10449
- return settings;
10450
- } // Add new borderColor attribute to block settings.
10451
 
10452
 
10453
- return { ...settings,
10454
- attributes: { ...settings.attributes,
10455
- borderColor: {
10456
- type: 'string'
10457
- }
10458
- }
10459
- };
10460
- }
10461
  /**
10462
- * Override props assigned to save component to inject border color.
10463
- *
10464
- * @param {Object} props Additional props applied to save element.
10465
- * @param {Object} blockType Block type definition.
10466
- * @param {Object} attributes Block's attributes.
10467
- *
10468
- * @return {Object} Filtered props to apply to save element.
10469
  */
10470
 
10471
 
10472
- function border_color_addSaveProps(props, blockType, attributes) {
10473
- var _style$border2;
10474
 
10475
- if (!hasBorderSupport(blockType, 'color') || shouldSkipSerialization(blockType)) {
10476
- return props;
10477
- }
10478
 
10479
- const {
10480
- borderColor,
10481
- style
10482
- } = attributes;
10483
- const borderColorClass = getColorClassName('border-color', borderColor);
10484
- const newClassName = classnames_default()(props.className, {
10485
- 'has-border-color': borderColor || (style === null || style === void 0 ? void 0 : (_style$border2 = style.border) === null || _style$border2 === void 0 ? void 0 : _style$border2.color),
10486
- [borderColorClass]: !!borderColorClass
10487
- }); // If we are clearing the last of the previous classes in `className`
10488
- // set it to `undefined` to avoid rendering empty DOM attributes.
10489
 
10490
- props.className = newClassName ? newClassName : undefined;
10491
- return props;
10492
- }
10493
  /**
10494
- * Filters the registered block settings to apply border color styles and
10495
- * classnames to the block edit wrapper.
10496
- *
10497
- * @param {Object} settings Original block settings.
10498
- *
10499
- * @return {Object} Filtered block settings.
10500
  */
10501
 
10502
 
10503
- function addEditProps(settings) {
10504
- if (!hasBorderSupport(settings, 'color') || shouldSkipSerialization(settings)) {
10505
- return settings;
10506
- }
10507
 
10508
- const existingGetEditWrapperProps = settings.getEditWrapperProps;
10509
 
10510
- settings.getEditWrapperProps = attributes => {
10511
- let props = {};
 
 
 
 
 
 
 
 
 
10512
 
10513
- if (existingGetEditWrapperProps) {
10514
- props = existingGetEditWrapperProps(attributes);
10515
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10516
 
10517
- return border_color_addSaveProps(props, settings, attributes);
10518
- };
 
10519
 
10520
- return settings;
10521
- }
10522
- /**
10523
- * This adds inline styles for color palette colors.
10524
- * Ideally, this is not needed and themes should load their palettes on the editor.
10525
- *
10526
- * @param {Function} BlockListBlock Original component.
10527
- *
10528
- * @return {Function} Wrapped component.
10529
- */
10530
 
 
 
 
10531
 
10532
- const withBorderColorPaletteStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockListBlock => props => {
10533
- var _getColorObjectByAttr2, _props$wrapperProps;
 
 
 
10534
 
 
 
 
 
 
 
 
10535
  const {
10536
- name,
10537
- attributes
10538
- } = props;
10539
- const {
10540
- borderColor
10541
- } = attributes;
10542
- const colors = useSetting('color.palette') || border_color_EMPTY_ARRAY;
10543
 
10544
- if (!hasBorderSupport(name, 'color') || shouldSkipSerialization(name)) {
10545
- return (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, props);
10546
- }
10547
 
10548
- const extraStyles = {
10549
- borderColor: borderColor ? (_getColorObjectByAttr2 = getColorObjectByAttributeValues(colors, borderColor)) === null || _getColorObjectByAttr2 === void 0 ? void 0 : _getColorObjectByAttr2.color : undefined
10550
- };
10551
- let wrapperProps = props.wrapperProps;
10552
- wrapperProps = { ...props.wrapperProps,
10553
- style: { ...extraStyles,
10554
- ...((_props$wrapperProps = props.wrapperProps) === null || _props$wrapperProps === void 0 ? void 0 : _props$wrapperProps.style)
10555
  }
 
10556
  };
10557
- return (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, _extends({}, props, {
10558
- wrapperProps: wrapperProps
10559
- }));
10560
- });
10561
- (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/border/addAttributes', addAttributes);
10562
- (0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/border/addSaveProps', border_color_addSaveProps);
10563
- (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/border/addEditProps', addEditProps);
10564
- (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/border/with-border-color-palette-styles', withBorderColorPaletteStyles);
10565
- //# sourceMappingURL=border-color.js.map
10566
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/border-radius-control/utils.js
10567
- /**
10568
- * WordPress dependencies
10569
- */
10570
 
10571
- /**
10572
- * Gets the item with the highest occurrence within an array
10573
- * https://stackoverflow.com/a/20762713
10574
- *
10575
- * @param {Array<any>} arr Array of items to check.
10576
- * @return {any} The item with the most occurrences.
10577
- */
10578
 
10579
- function mode(arr) {
10580
- return arr.sort((a, b) => arr.filter(v => v === a).length - arr.filter(v => v === b).length).pop();
10581
- }
10582
  /**
10583
- * Returns the most common CSS unit in the radius values.
10584
- *
10585
- * @param {Object|string} values Radius values.
10586
- * @return {string} Most common CSS unit in values.
10587
  */
10588
 
10589
-
10590
- function getAllUnit(values = {}) {
10591
- if (typeof values === 'string') {
10592
- const [, unit] = (0,external_wp_components_namespaceObject.__experimentalParseUnit)(values);
10593
- return unit || 'px';
10594
- }
10595
-
10596
- const allUnits = Object.values(values).map(value => {
10597
- const [, unit] = (0,external_wp_components_namespaceObject.__experimentalParseUnit)(value);
10598
- return unit;
10599
- });
10600
- return mode(allUnits);
10601
- }
10602
  /**
10603
- * Gets the 'all' input value and unit from values data.
10604
- *
10605
- * @param {Object|string} values Radius values.
10606
- * @return {string} A value + unit for the 'all' input.
10607
  */
10608
 
10609
- function getAllValue(values = {}) {
10610
- /**
10611
- * Border radius support was originally a single pixel value.
10612
- *
10613
- * To maintain backwards compatibility treat this case as the all value.
10614
- */
10615
- if (typeof values === 'string') {
10616
- return values;
10617
- }
10618
 
10619
- const parsedValues = Object.values(values).map(value => (0,external_wp_components_namespaceObject.__experimentalParseUnit)(value));
10620
- const allValues = parsedValues.map(value => value[0]);
10621
- const allUnits = parsedValues.map(value => value[1]);
10622
- const value = allValues.every(v => v === allValues[0]) ? allValues[0] : '';
10623
- const unit = mode(allUnits);
10624
- const allValue = value === 0 || value ? `${value}${unit}` : null;
10625
- return allValue;
10626
- }
10627
  /**
10628
- * Checks to determine if values are mixed.
10629
- *
10630
- * @param {Object} values Radius values.
10631
- * @return {boolean} Whether values are mixed.
10632
  */
10633
 
10634
- function hasMixedValues(values = {}) {
10635
- const allValue = getAllValue(values);
10636
- const isMixed = isNaN(parseFloat(allValue));
10637
- return isMixed;
10638
- }
10639
- /**
10640
- * Checks to determine if values are defined.
10641
- *
10642
- * @param {Object} values Radius values.
10643
- * @return {boolean} Whether values are mixed.
10644
- */
10645
 
10646
- function hasDefinedValues(values) {
10647
- if (!values) {
10648
- return false;
10649
- } // A string value represents a shorthand value.
 
 
 
10650
 
 
 
 
 
 
10651
 
10652
- if (typeof values === 'string') {
10653
- return true;
10654
- } // An object represents longhand border radius values, if any are set
10655
- // flag values as being defined.
10656
 
 
 
10657
 
10658
- const filteredValues = Object.values(values).filter(value => {
10659
- return !!value || value === 0;
10660
- });
10661
- return !!filteredValues.length;
10662
  }
10663
- //# sourceMappingURL=utils.js.map
10664
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/border-radius-control/all-input-control.js
10665
 
 
 
 
 
 
10666
 
10667
 
10668
  /**
10669
- * WordPress dependencies
10670
  */
10671
 
10672
-
10673
  /**
10674
- * Internal dependencies
10675
  */
10676
 
10677
 
10678
- function AllInputControl({
10679
- onChange,
10680
- values,
10681
- ...props
10682
- }) {
10683
- const allValue = getAllValue(values);
10684
- const hasValues = hasDefinedValues(values);
10685
- const isMixed = hasValues && hasMixedValues(values);
10686
- const allPlaceholder = isMixed ? (0,external_wp_i18n_namespaceObject.__)('Mixed') : null;
10687
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, _extends({}, props, {
10688
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Border radius'),
10689
- disableUnits: isMixed,
10690
- isOnly: true,
10691
- value: allValue,
10692
- onChange: onChange,
10693
- placeholder: allPlaceholder
10694
- }));
10695
- }
10696
- //# sourceMappingURL=all-input-control.js.map
10697
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/border-radius-control/input-controls.js
10698
-
10699
 
10700
 
10701
  /**
10702
- * WordPress dependencies
10703
  */
10704
 
10705
 
10706
- const CORNERS = {
10707
- topLeft: (0,external_wp_i18n_namespaceObject.__)('Top left'),
10708
- topRight: (0,external_wp_i18n_namespaceObject.__)('Top right'),
10709
- bottomLeft: (0,external_wp_i18n_namespaceObject.__)('Bottom left'),
10710
- bottomRight: (0,external_wp_i18n_namespaceObject.__)('Bottom right')
10711
- };
10712
- function BoxInputControls({
10713
- onChange,
10714
- values: valuesProp,
10715
- ...props
10716
  }) {
10717
- const createHandleOnChange = corner => next => {
10718
- if (!onChange) {
 
 
 
 
 
 
 
 
10719
  return;
10720
  }
10721
 
10722
- onChange({ ...values,
10723
- [corner]: next ? next : undefined
10724
- });
10725
- }; // For shorthand style & backwards compatibility, handle flat string value.
10726
 
 
 
 
 
 
 
 
10727
 
10728
- const values = typeof valuesProp !== 'string' ? valuesProp : {
10729
- topLeft: valuesProp,
10730
- topRight: valuesProp,
10731
- bottomLeft: valuesProp,
10732
- bottomRight: valuesProp
10733
- }; // Controls are wrapped in tooltips as visible labels aren't desired here.
10734
 
10735
- return (0,external_wp_element_namespaceObject.createElement)("div", {
10736
- className: "components-border-radius-control__input-controls-wrapper"
10737
- }, Object.entries(CORNERS).map(([key, label]) => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, _extends({}, props, {
10738
- key: key,
10739
- "aria-label": label,
10740
- value: values[key],
10741
- onChange: createHandleOnChange(key)
10742
- }))));
 
10743
  }
10744
- //# sourceMappingURL=input-controls.js.map
10745
- ;// CONCATENATED MODULE: ./packages/icons/build-module/library/link.js
10746
 
 
 
 
 
 
 
10747
 
10748
- /**
10749
- * WordPress dependencies
10750
- */
10751
 
10752
- const link_link = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
10753
- xmlns: "http://www.w3.org/2000/svg",
10754
- viewBox: "0 0 24 24"
10755
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
10756
- d: "M15.6 7.2H14v1.5h1.6c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.8 0 5.2-2.3 5.2-5.2 0-2.9-2.3-5.2-5.2-5.2zM4.7 12.4c0-2 1.7-3.7 3.7-3.7H10V7.2H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H10v-1.5H8.4c-2 0-3.7-1.7-3.7-3.7zm4.6.9h5.3v-1.5H9.3v1.5z"
10757
- }));
10758
- /* harmony default export */ var library_link = (link_link);
10759
- //# sourceMappingURL=link.js.map
10760
- ;// CONCATENATED MODULE: ./packages/icons/build-module/library/link-off.js
10761
 
 
10762
 
10763
- /**
10764
- * WordPress dependencies
10765
- */
10766
 
10767
- const linkOff = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
10768
- xmlns: "http://www.w3.org/2000/svg",
10769
- viewBox: "0 0 24 24"
10770
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
10771
- d: "M15.6 7.3h-.7l1.6-3.5-.9-.4-3.9 8.5H9v1.5h2l-1.3 2.8H8.4c-2 0-3.7-1.7-3.7-3.7s1.7-3.7 3.7-3.7H10V7.3H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H9l-1.4 3.2.9.4 5.7-12.5h1.4c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.9 0 5.2-2.3 5.2-5.2 0-2.9-2.4-5.2-5.2-5.2z"
10772
- }));
10773
- /* harmony default export */ var link_off = (linkOff);
10774
- //# sourceMappingURL=link-off.js.map
10775
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/border-radius-control/linked-button.js
10776
 
 
10777
 
 
10778
 
10779
- /**
10780
- * WordPress dependencies
10781
- */
10782
 
 
 
10783
 
 
 
 
 
 
10784
 
10785
- function LinkedButton({
10786
- isLinked,
10787
- ...props
10788
- }) {
10789
- const label = isLinked ? (0,external_wp_i18n_namespaceObject.__)('Unlink Radii') : (0,external_wp_i18n_namespaceObject.__)('Link Radii');
10790
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Tooltip, {
10791
- text: label
10792
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({}, props, {
10793
- className: "component-border-radius-control__linked-button",
10794
- isPrimary: isLinked,
10795
- isSecondary: !isLinked,
10796
- isSmall: true,
10797
- icon: isLinked ? library_link : link_off,
10798
- iconSize: 16,
10799
- "aria-label": label
10800
- })));
10801
- }
10802
- //# sourceMappingURL=linked-button.js.map
10803
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/border-radius-control/index.js
10804
 
 
10805
 
10806
- /**
10807
- * WordPress dependencies
10808
- */
 
10809
 
 
 
 
 
 
10810
 
 
 
10811
 
10812
- /**
10813
- * Internal dependencies
10814
- */
 
 
 
 
 
 
 
 
 
 
 
10815
 
 
 
 
 
10816
 
 
 
10817
 
 
10818
 
 
10819
 
 
10820
 
10821
- const DEFAULT_VALUES = {
10822
- topLeft: null,
10823
- topRight: null,
10824
- bottomLeft: null,
10825
- bottomRight: null
10826
- };
10827
- const MIN_BORDER_RADIUS_VALUE = 0;
10828
- const MAX_BORDER_RADIUS_VALUES = {
10829
- px: 100,
10830
- em: 20,
10831
- rem: 20
10832
  };
10833
- /**
10834
- * Control to display border radius options.
10835
- *
10836
- * @param {Object} props Component props.
10837
- * @param {Function} props.onChange Callback to handle onChange.
10838
- * @param {Object} props.values Border radius values.
10839
- *
10840
- * @return {WPElement} Custom border radius control.
10841
- */
10842
 
10843
- function BorderRadiusControl({
10844
- onChange,
10845
- values
10846
- }) {
10847
- const [isLinked, setIsLinked] = (0,external_wp_element_namespaceObject.useState)(!hasDefinedValues(values) || !hasMixedValues(values));
10848
- const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
10849
- availableUnits: useSetting('spacing.units') || ['px', 'em', 'rem']
10850
- });
10851
- const unit = getAllUnit(values);
10852
- const unitConfig = units && units.find(item => item.value === unit);
10853
- const step = (unitConfig === null || unitConfig === void 0 ? void 0 : unitConfig.step) || 1;
10854
- const [allValue] = (0,external_wp_components_namespaceObject.__experimentalParseUnit)(getAllValue(values));
10855
 
10856
- const toggleLinked = () => setIsLinked(!isLinked);
 
 
 
 
 
 
 
 
10857
 
10858
- const handleSliderChange = next => {
10859
- onChange(next !== undefined ? `${next}${unit}` : undefined);
10860
- };
10861
 
10862
- return (0,external_wp_element_namespaceObject.createElement)("fieldset", {
10863
- className: "components-border-radius-control"
10864
- }, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_i18n_namespaceObject.__)('Radius')), (0,external_wp_element_namespaceObject.createElement)("div", {
10865
- className: "components-border-radius-control__wrapper"
10866
- }, isLinked ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(AllInputControl, {
10867
- className: "components-border-radius-control__unit-control",
10868
- values: values,
10869
- min: MIN_BORDER_RADIUS_VALUE,
10870
- onChange: onChange,
10871
- unit: unit,
10872
- units: units
10873
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.RangeControl, {
10874
- className: "components-border-radius-control__range-control",
10875
- value: allValue,
10876
- min: MIN_BORDER_RADIUS_VALUE,
10877
- max: MAX_BORDER_RADIUS_VALUES[unit],
10878
- initialPosition: 0,
10879
- withInputField: false,
10880
- onChange: handleSliderChange,
10881
- step: step
10882
- })) : (0,external_wp_element_namespaceObject.createElement)(BoxInputControls, {
10883
- min: MIN_BORDER_RADIUS_VALUE,
10884
- onChange: onChange,
10885
- values: values || DEFAULT_VALUES,
10886
- units: units
10887
- }), (0,external_wp_element_namespaceObject.createElement)(LinkedButton, {
10888
- onClick: toggleLinked,
10889
- isLinked: isLinked
10890
- })));
10891
  }
10892
- //# sourceMappingURL=index.js.map
10893
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/border-radius.js
10894
 
 
 
 
 
 
 
10895
 
10896
- /**
10897
- * Internal dependencies
10898
- */
 
10899
 
 
 
 
 
10900
 
10901
- /**
10902
- * Inspector control panel containing the border radius related configuration.
10903
- *
10904
- * @param {Object} props Block properties.
10905
- *
10906
- * @return {WPElement} Border radius edit element.
10907
- */
10908
 
10909
- function BorderRadiusEdit(props) {
10910
- var _style$border;
 
 
 
 
 
 
10911
 
10912
- const {
10913
- attributes: {
10914
- style
10915
  },
10916
- setAttributes
10917
- } = props;
10918
 
10919
- const onChange = newRadius => {
10920
- let newStyle = { ...style,
10921
- border: { ...(style === null || style === void 0 ? void 0 : style.border),
10922
- radius: newRadius
 
 
 
10923
  }
10924
- };
10925
-
10926
- if (newRadius === undefined || newRadius === '') {
10927
- newStyle = cleanEmptyObject(newStyle);
10928
  }
10929
 
10930
- setAttributes({
10931
- style: newStyle
10932
- });
10933
  };
 
10934
 
10935
- return (0,external_wp_element_namespaceObject.createElement)(BorderRadiusControl, {
10936
- values: style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.radius,
10937
- onChange: onChange
 
 
 
 
10938
  });
10939
  }
10940
- //# sourceMappingURL=border-radius.js.map
10941
- ;// CONCATENATED MODULE: ./packages/icons/build-module/library/line-solid.js
10942
 
 
 
10943
 
10944
- /**
10945
- * WordPress dependencies
10946
- */
10947
-
10948
- const lineSolid = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
10949
- xmlns: "http://www.w3.org/2000/svg",
10950
- width: "24",
10951
- height: "24",
10952
- fill: "none"
10953
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
10954
- d: "M5 11.25h14v1.5H5z"
10955
- }));
10956
- /* harmony default export */ var line_solid = (lineSolid);
10957
- //# sourceMappingURL=line-solid.js.map
10958
- ;// CONCATENATED MODULE: ./packages/icons/build-module/library/line-dashed.js
10959
 
 
10960
 
10961
- /**
10962
- * WordPress dependencies
10963
- */
10964
 
10965
- const lineDashed = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
10966
- xmlns: "http://www.w3.org/2000/svg",
10967
- width: "24",
10968
- height: "24",
10969
- fill: "none"
10970
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
10971
- fillRule: "evenodd",
10972
- d: "M5 11.25h3v1.5H5v-1.5zm5.5 0h3v1.5h-3v-1.5zm8.5 0h-3v1.5h3v-1.5z",
10973
- clipRule: "evenodd"
10974
- }));
10975
- /* harmony default export */ var line_dashed = (lineDashed);
10976
- //# sourceMappingURL=line-dashed.js.map
10977
- ;// CONCATENATED MODULE: ./packages/icons/build-module/library/line-dotted.js
10978
 
 
 
 
 
10979
 
10980
- /**
10981
- * WordPress dependencies
10982
- */
10983
 
10984
- const lineDotted = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
10985
- xmlns: "http://www.w3.org/2000/svg",
10986
- width: "24",
10987
- height: "24",
10988
- fill: "none"
10989
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
10990
- fillRule: "evenodd",
10991
- d: "M5.25 11.25h1.5v1.5h-1.5v-1.5zm3 0h1.5v1.5h-1.5v-1.5zm4.5 0h-1.5v1.5h1.5v-1.5zm1.5 0h1.5v1.5h-1.5v-1.5zm4.5 0h-1.5v1.5h1.5v-1.5z",
10992
- clipRule: "evenodd"
10993
- }));
10994
- /* harmony default export */ var line_dotted = (lineDotted);
10995
- //# sourceMappingURL=line-dotted.js.map
10996
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/border-style-control/index.js
10997
 
10998
 
10999
- /**
11000
- * WordPress dependencies
11001
- */
11002
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11003
 
 
 
 
11004
 
11005
- const BORDER_STYLES = [{
11006
- label: (0,external_wp_i18n_namespaceObject.__)('Solid'),
11007
- icon: line_solid,
11008
- value: 'solid'
11009
- }, {
11010
- label: (0,external_wp_i18n_namespaceObject.__)('Dashed'),
11011
- icon: line_dashed,
11012
- value: 'dashed'
11013
- }, {
11014
- label: (0,external_wp_i18n_namespaceObject.__)('Dotted'),
11015
- icon: line_dotted,
11016
- value: 'dotted'
11017
- }];
11018
- /**
11019
- * Control to display border style options.
11020
- *
11021
- * @param {Object} props Component props.
11022
- * @param {Function} props.onChange Handler for changing border style selection.
11023
- * @param {string} props.value Currently selected border style value.
11024
- *
11025
- * @return {WPElement} Custom border style segmented control.
11026
- */
11027
 
11028
- function BorderStyleControl({
11029
- onChange,
11030
- value
11031
- }) {
11032
- return (0,external_wp_element_namespaceObject.createElement)("fieldset", {
11033
- className: "components-border-style-control"
11034
- }, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_i18n_namespaceObject.__)('Style')), (0,external_wp_element_namespaceObject.createElement)("div", {
11035
- className: "components-border-style-control__buttons"
11036
- }, BORDER_STYLES.map(borderStyle => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
11037
- key: borderStyle.value,
11038
- icon: borderStyle.icon,
11039
- isSmall: true,
11040
- isPressed: borderStyle.value === value,
11041
- onClick: () => onChange(borderStyle.value === value ? undefined : borderStyle.value),
11042
- "aria-label": borderStyle.label
11043
- }))));
11044
  }
11045
- //# sourceMappingURL=index.js.map
11046
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/border-style.js
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11047
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11048
 
11049
- /**
11050
- * Internal dependencies
11051
- */
 
 
 
 
 
 
11052
 
 
 
 
 
 
 
 
 
11053
 
11054
- /**
11055
- * Inspector control for configuring border style property.
11056
- *
11057
- * @param {Object} props Block properties.
11058
- *
11059
- * @return {WPElement} Border style edit element.
11060
- */
 
 
11061
 
11062
- const BorderStyleEdit = props => {
11063
- var _style$border;
11064
 
11065
- const {
11066
- attributes: {
11067
- style
11068
- },
11069
- setAttributes
11070
- } = props;
11071
 
11072
- const onChange = newBorderStyle => {
11073
- const newStyleAttributes = { ...style,
11074
- border: { ...(style === null || style === void 0 ? void 0 : style.border),
11075
- style: newBorderStyle
11076
  }
11077
- };
11078
- setAttributes({
11079
- style: cleanEmptyObject(newStyleAttributes)
11080
- });
11081
- };
 
 
11082
 
11083
- return (0,external_wp_element_namespaceObject.createElement)(BorderStyleControl, {
11084
- value: style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.style,
11085
- onChange: onChange
11086
- });
11087
  };
11088
- //# sourceMappingURL=border-style.js.map
11089
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/border-width.js
11090
 
 
 
 
 
 
11091
 
11092
- /**
11093
- * WordPress dependencies
11094
- */
11095
 
 
 
 
11096
 
 
 
11097
 
11098
- /**
11099
- * Internal dependencies
11100
- */
11101
 
 
 
 
11102
 
 
 
 
 
 
11103
 
11104
- const MIN_BORDER_WIDTH = 0;
11105
- /**
11106
- * Inspector control for configuring border width property.
11107
- *
11108
- * @param {Object} props Block properties.
11109
- *
11110
- * @return {WPElement} Border width edit element.
11111
- */
11112
 
11113
- const BorderWidthEdit = props => {
11114
- const {
11115
- attributes: {
11116
- borderColor,
11117
- style
11118
- },
11119
- setAttributes
11120
- } = props;
11121
- const {
11122
- width,
11123
- color: customBorderColor,
11124
- style: borderStyle
11125
- } = (style === null || style === void 0 ? void 0 : style.border) || {};
11126
- const [styleSelection, setStyleSelection] = (0,external_wp_element_namespaceObject.useState)();
11127
- const [colorSelection, setColorSelection] = (0,external_wp_element_namespaceObject.useState)(); // Temporarily track previous border color & style selections to be able to
11128
- // restore them when border width changes from zero value.
11129
 
11130
- (0,external_wp_element_namespaceObject.useEffect)(() => {
11131
- if (borderStyle !== 'none') {
11132
- setStyleSelection(borderStyle);
11133
- }
11134
- }, [borderStyle]);
11135
- (0,external_wp_element_namespaceObject.useEffect)(() => {
11136
- if (borderColor || customBorderColor) {
11137
- setColorSelection({
11138
- name: !!borderColor ? borderColor : undefined,
11139
- color: !!customBorderColor ? customBorderColor : undefined
11140
- });
11141
- }
11142
- }, [borderColor, customBorderColor]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11143
 
11144
- const onChange = newWidth => {
11145
- let newStyle = { ...style,
11146
- border: { ...(style === null || style === void 0 ? void 0 : style.border),
11147
- width: newWidth
11148
- }
11149
- }; // Used to clear named border color attribute.
11150
 
11151
- let borderPaletteColor = borderColor;
11152
- const hasZeroWidth = parseFloat(newWidth) === 0; // Setting the border width explicitly to zero will also set the
11153
- // border style to `none` and clear border color attributes.
11154
 
11155
- if (hasZeroWidth) {
11156
- borderPaletteColor = undefined;
11157
- newStyle.border.color = undefined;
11158
- newStyle.border.style = 'none';
11159
- } // Restore previous border style selection if width is now not zero and
11160
- // border style was 'none'. This is to support changes to the UI which
11161
- // change the border style UI to a segmented control without a "none"
11162
- // option.
11163
 
 
 
11164
 
11165
- if (!hasZeroWidth && borderStyle === 'none') {
11166
- newStyle.border.style = styleSelection;
11167
- } // Restore previous border color selection if width is no longer zero
11168
- // and current border color is undefined.
11169
 
 
11170
 
11171
- if (!hasZeroWidth && borderColor === undefined) {
11172
- borderPaletteColor = colorSelection === null || colorSelection === void 0 ? void 0 : colorSelection.name;
11173
- newStyle.border.color = colorSelection === null || colorSelection === void 0 ? void 0 : colorSelection.color;
11174
- } // If width was reset, clean out undefined styles.
11175
 
 
 
 
11176
 
11177
- if (newWidth === undefined || newWidth === '') {
11178
- newStyle = cleanEmptyObject(newStyle);
11179
- }
11180
 
11181
- setAttributes({
11182
- borderColor: borderPaletteColor,
11183
- style: newStyle
11184
- });
11185
- };
11186
 
11187
- const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
11188
- availableUnits: useSetting('spacing.units') || ['px', 'em', 'rem']
11189
- });
11190
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
11191
- value: width,
11192
- label: (0,external_wp_i18n_namespaceObject.__)('Width'),
11193
- min: MIN_BORDER_WIDTH,
11194
- onChange: onChange,
11195
- units: units
11196
- });
11197
- };
11198
- //# sourceMappingURL=border-width.js.map
11199
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/border.js
11200
 
 
 
 
11201
 
11202
- /**
11203
- * WordPress dependencies
11204
- */
11205
 
 
 
 
11206
 
 
 
11207
 
 
 
 
 
 
 
 
 
11208
 
11209
- /**
11210
- * Internal dependencies
11211
- */
 
 
 
 
 
11212
 
 
 
 
 
 
 
11213
 
 
 
 
 
11214
 
 
 
 
 
 
 
11215
 
 
 
 
 
 
 
11216
 
 
 
 
 
 
 
 
 
 
 
11217
 
 
 
 
 
11218
 
11219
- const BORDER_SUPPORT_KEY = '__experimentalBorder';
11220
- function BorderPanel(props) {
11221
- const isDisabled = useIsBorderDisabled(props);
11222
- const isSupported = hasBorderSupport(props.name);
11223
- const isColorSupported = useSetting('border.customColor') && hasBorderSupport(props.name, 'color');
11224
- const isRadiusSupported = useSetting('border.customRadius') && hasBorderSupport(props.name, 'radius');
11225
- const isStyleSupported = useSetting('border.customStyle') && hasBorderSupport(props.name, 'style');
11226
- const isWidthSupported = useSetting('border.customWidth') && hasBorderSupport(props.name, 'width');
11227
 
11228
- if (isDisabled || !isSupported) {
11229
- return null;
11230
  }
11231
 
11232
- return (0,external_wp_element_namespaceObject.createElement)(inspector_controls, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
11233
- className: "block-editor-hooks__border-controls",
11234
- title: (0,external_wp_i18n_namespaceObject.__)('Border'),
11235
- initialOpen: false
11236
- }, (isWidthSupported || isStyleSupported) && (0,external_wp_element_namespaceObject.createElement)("div", {
11237
- className: "block-editor-hooks__border-controls-row"
11238
- }, isWidthSupported && (0,external_wp_element_namespaceObject.createElement)(BorderWidthEdit, props), isStyleSupported && (0,external_wp_element_namespaceObject.createElement)(BorderStyleEdit, props)), isColorSupported && (0,external_wp_element_namespaceObject.createElement)(BorderColorEdit, props), isRadiusSupported && (0,external_wp_element_namespaceObject.createElement)(BorderRadiusEdit, props)));
11239
- }
11240
- /**
11241
- * Determine whether there is block support for border properties.
11242
- *
11243
- * @param {string} blockName Block name.
11244
- * @param {string} feature Border feature to check support for.
11245
- *
11246
- * @return {boolean} Whether there is support.
11247
- */
11248
 
11249
- function hasBorderSupport(blockName, feature = 'any') {
11250
- if (external_wp_element_namespaceObject.Platform.OS !== 'web') {
11251
- return false;
11252
- }
11253
 
11254
- const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, BORDER_SUPPORT_KEY);
 
 
 
 
11255
 
11256
- if (support === true) {
11257
- return true;
 
 
 
11258
  }
11259
 
11260
- if (feature === 'any') {
11261
- return !!(support !== null && support !== void 0 && support.color || support !== null && support !== void 0 && support.radius || support !== null && support !== void 0 && support.width || support !== null && support !== void 0 && support.style);
11262
  }
11263
 
11264
- return !!(support !== null && support !== void 0 && support[feature]);
 
 
 
 
 
11265
  }
11266
- /**
11267
- * Check whether serialization of border classes and styles should be skipped.
11268
- *
11269
- * @param {string|Object} blockType Block name or block type object.
11270
- *
11271
- * @return {boolean} Whether serialization of border properties should occur.
11272
- */
11273
 
11274
- function shouldSkipSerialization(blockType) {
11275
- const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, BORDER_SUPPORT_KEY);
11276
- return support === null || support === void 0 ? void 0 : support.__experimentalSkipSerialization;
 
11277
  }
11278
- /**
11279
- * Determines if all border support features have been disabled.
11280
- *
11281
- * @return {boolean} If border support is completely disabled.
11282
- */
11283
 
11284
- const useIsBorderDisabled = () => {
11285
- const configs = [!useSetting('border.customColor'), !useSetting('border.customRadius'), !useSetting('border.customStyle'), !useSetting('border.customWidth')];
11286
- return configs.every(Boolean);
11287
- };
11288
- //# sourceMappingURL=border.js.map
11289
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/colors-gradients/panel-color-gradient-settings.js
11290
 
 
 
 
 
 
 
11291
 
 
 
11292
 
11293
- /**
11294
- * External dependencies
11295
- */
11296
 
 
 
11297
 
11298
- /**
11299
- * WordPress dependencies
11300
- */
11301
 
 
11302
 
 
11303
 
11304
- /**
11305
- * Internal dependencies
11306
- */
 
 
 
 
11307
 
 
 
11308
 
 
 
 
 
 
 
11309
 
 
 
 
 
11310
 
11311
- // translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)
 
 
11312
 
11313
- const panel_color_gradient_settings_colorIndicatorAriaLabel = (0,external_wp_i18n_namespaceObject.__)('(%s: color %s)'); // translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)
 
11314
 
 
11315
 
11316
- const panel_color_gradient_settings_gradientIndicatorAriaLabel = (0,external_wp_i18n_namespaceObject.__)('(%s: gradient %s)');
11317
 
11318
- const panel_color_gradient_settings_colorsAndGradientKeys = ['colors', 'disableCustomColors', 'gradients', 'disableCustomGradients'];
 
 
11319
 
11320
- const Indicators = ({
11321
- colors,
11322
- gradients,
11323
- settings
11324
- }) => {
11325
- return settings.map(({
11326
- colorValue,
11327
- gradientValue,
11328
- label,
11329
- colors: availableColors,
11330
- gradients: availableGradients
11331
- }, index) => {
11332
- if (!colorValue && !gradientValue) {
11333
- return null;
11334
  }
11335
 
11336
- let ariaLabel;
 
11337
 
11338
- if (colorValue) {
11339
- const colorObject = getColorObjectByColorValue(availableColors || colors, colorValue);
11340
- ariaLabel = (0,external_wp_i18n_namespaceObject.sprintf)(panel_color_gradient_settings_colorIndicatorAriaLabel, label.toLowerCase(), colorObject && colorObject.name || colorValue);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11341
  } else {
11342
- const gradientObject = __experimentalGetGradientObjectByGradientValue(availableGradients || gradients, colorValue);
 
11343
 
11344
- ariaLabel = (0,external_wp_i18n_namespaceObject.sprintf)(panel_color_gradient_settings_gradientIndicatorAriaLabel, label.toLowerCase(), gradientObject && gradientObject.name || gradientValue);
 
11345
  }
 
 
11346
 
11347
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
11348
- key: index,
11349
- colorValue: colorValue || gradientValue,
11350
- "aria-label": ariaLabel
11351
- });
11352
- });
11353
- };
11354
 
11355
- const PanelColorGradientSettingsInner = ({
11356
- className,
11357
- colors,
11358
- gradients,
11359
- disableCustomColors,
11360
- disableCustomGradients,
11361
- children,
11362
- settings,
11363
- title,
11364
- showTitle = true,
11365
- ...props
11366
- }) => {
11367
- if ((0,external_lodash_namespaceObject.isEmpty)(colors) && (0,external_lodash_namespaceObject.isEmpty)(gradients) && disableCustomColors && disableCustomGradients && (0,external_lodash_namespaceObject.every)(settings, setting => (0,external_lodash_namespaceObject.isEmpty)(setting.colors) && (0,external_lodash_namespaceObject.isEmpty)(setting.gradients) && (setting.disableCustomColors === undefined || setting.disableCustomColors) && (setting.disableCustomGradients === undefined || setting.disableCustomGradients))) {
11368
- return null;
11369
- }
11370
 
11371
- const titleElement = (0,external_wp_element_namespaceObject.createElement)("span", {
11372
- className: "block-editor-panel-color-gradient-settings__panel-title"
11373
- }, title, (0,external_wp_element_namespaceObject.createElement)(Indicators, {
11374
- colors: colors,
11375
- gradients: gradients,
11376
- settings: settings
 
 
 
 
 
 
11377
  }));
11378
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, _extends({
11379
- className: classnames_default()('block-editor-panel-color-gradient-settings', className),
11380
- title: showTitle ? titleElement : undefined
11381
- }, props), settings.map((setting, index) => (0,external_wp_element_namespaceObject.createElement)(control, _extends({
11382
- key: index,
11383
- colors,
11384
- gradients,
11385
- disableCustomColors,
11386
- disableCustomGradients
11387
- }, setting))), children);
11388
  };
11389
 
11390
- const PanelColorGradientSettingsSelect = props => {
11391
- const colorGradientSettings = {};
11392
- colorGradientSettings.colors = useSetting('color.palette');
11393
- colorGradientSettings.gradients = useSetting('color.gradients');
11394
- colorGradientSettings.disableCustomColors = !useSetting('color.custom');
11395
- colorGradientSettings.disableCustomGradients = !useSetting('color.customGradient');
11396
- return (0,external_wp_element_namespaceObject.createElement)(PanelColorGradientSettingsInner, _extends({}, colorGradientSettings, props));
11397
- };
11398
 
11399
- const PanelColorGradientSettings = props => {
11400
- if ((0,external_lodash_namespaceObject.every)(panel_color_gradient_settings_colorsAndGradientKeys, key => props.hasOwnProperty(key))) {
11401
- return (0,external_wp_element_namespaceObject.createElement)(PanelColorGradientSettingsInner, props);
 
 
 
11402
  }
11403
 
11404
- return (0,external_wp_element_namespaceObject.createElement)(PanelColorGradientSettingsSelect, props);
 
 
 
 
 
11405
  };
11406
 
11407
- /* harmony default export */ var panel_color_gradient_settings = (PanelColorGradientSettings);
11408
- //# sourceMappingURL=panel-color-gradient-settings.js.map
11409
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/contrast-checker/index.js
11410
-
11411
-
11412
- /**
11413
- * External dependencies
11414
- */
11415
-
11416
 
 
 
 
11417
 
11418
- /**
11419
- * WordPress dependencies
11420
- */
11421
 
 
 
 
 
 
 
 
 
 
 
11422
 
 
 
 
 
 
 
 
 
 
11423
 
 
 
 
 
 
 
 
 
11424
 
 
 
11425
 
11426
- k([names, a11y]);
 
 
 
 
 
 
 
 
11427
 
11428
- function ContrastCheckerMessage({
11429
- colordBackgroundColor,
11430
- colordTextColor,
11431
- backgroundColor,
11432
- textColor
11433
- }) {
11434
- const msg = colordBackgroundColor.brightness() < colordTextColor.brightness() ? (0,external_wp_i18n_namespaceObject.__)('This color combination may be hard for people to read. Try using a darker background color and/or a brighter text color.') : (0,external_wp_i18n_namespaceObject.__)('This color combination may be hard for people to read. Try using a brighter background color and/or a darker text color.'); // Note: The `Notice` component can speak messages via its `spokenMessage`
11435
- // prop, but the contrast checker requires granular control over when the
11436
- // announcements are made. Notably, the message will be re-announced if a
11437
- // new color combination is selected and the contrast is still insufficient.
11438
 
11439
- (0,external_wp_element_namespaceObject.useEffect)(() => {
11440
- (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('This color combination may be hard for people to read.'));
11441
- }, [backgroundColor, textColor]);
11442
- return (0,external_wp_element_namespaceObject.createElement)("div", {
11443
- className: "block-editor-contrast-checker"
11444
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, {
11445
- spokenMessage: null,
11446
- status: "warning",
11447
- isDismissible: false
11448
- }, msg));
11449
  }
11450
 
11451
- function ContrastChecker({
11452
- backgroundColor,
11453
- fallbackBackgroundColor,
11454
- fallbackTextColor,
11455
- fontSize,
11456
- // font size value in pixels
11457
- isLargeText,
11458
- textColor
11459
- }) {
11460
- if (!(backgroundColor || fallbackBackgroundColor) || !(textColor || fallbackTextColor)) {
11461
- return null;
11462
  }
11463
 
11464
- const colordBackgroundColor = w(backgroundColor || fallbackBackgroundColor);
11465
- const colordTextColor = w(textColor || fallbackTextColor);
11466
- const hasTransparency = colordBackgroundColor.alpha() !== 1 || colordTextColor.alpha() !== 1;
11467
-
11468
- if (hasTransparency || colordTextColor.isReadable(colordBackgroundColor, {
11469
- level: 'AA',
11470
- size: isLargeText || isLargeText !== false && fontSize >= 24 ? 'large' : 'small'
11471
- })) {
11472
- return null;
11473
  }
11474
 
11475
- return (0,external_wp_element_namespaceObject.createElement)(ContrastCheckerMessage, {
11476
- backgroundColor: backgroundColor,
11477
- textColor: textColor,
11478
- colordBackgroundColor: colordBackgroundColor,
11479
- colordTextColor: colordTextColor
 
 
11480
  });
 
11481
  }
11482
 
11483
- /* harmony default export */ var contrast_checker = (ContrastChecker);
11484
- //# sourceMappingURL=index.js.map
11485
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/provider/block-refs-provider.js
11486
 
11487
 
11488
- /**
11489
- * WordPress dependencies
11490
- */
11491
 
11492
- const BlockRefs = (0,external_wp_element_namespaceObject.createContext)();
11493
- function BlockRefsProvider({
11494
- children
11495
- }) {
11496
- const value = (0,external_wp_element_namespaceObject.useMemo)(() => ({
11497
- refs: new Map(),
11498
- callbacks: new Map()
11499
- }), []);
11500
- return (0,external_wp_element_namespaceObject.createElement)(BlockRefs.Provider, {
11501
- value: value
11502
- }, children);
11503
- }
11504
- //# sourceMappingURL=block-refs-provider.js.map
11505
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-block-refs.js
11506
- /**
11507
- * WordPress dependencies
11508
- */
11509
 
11510
 
11511
- /**
11512
- * Internal dependencies
11513
- */
11514
 
11515
 
11516
- /** @typedef {import('@wordpress/element').RefCallback} RefCallback */
 
 
 
 
 
 
 
 
 
11517
 
11518
- /** @typedef {import('@wordpress/element').RefObject} RefObject */
 
 
11519
 
11520
- /**
11521
- * Provides a ref to the BlockRefs context.
11522
- *
11523
- * @param {string} clientId The client ID of the element ref.
11524
- *
11525
- * @return {RefCallback} Ref callback.
11526
- */
11527
 
11528
- function useBlockRefProvider(clientId) {
11529
- const {
11530
- refs,
11531
- callbacks
11532
- } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs);
11533
- const ref = (0,external_wp_element_namespaceObject.useRef)();
11534
- (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
11535
- refs.set(ref, clientId);
11536
- return () => {
11537
- refs.delete(ref);
11538
- };
11539
- }, [clientId]);
11540
- return (0,external_wp_compose_namespaceObject.useRefEffect)(element => {
11541
- // Update the ref in the provider.
11542
- ref.current = element; // Call any update functions.
11543
 
11544
- callbacks.forEach((id, setElement) => {
11545
- if (clientId === id) {
11546
- setElement(element);
11547
- }
11548
- });
11549
- }, [clientId]);
11550
- }
11551
- /**
11552
- * Gets a ref pointing to the current block element. Continues to return a
11553
- * stable ref even if the block client ID changes.
11554
- *
11555
- * @param {string} clientId The client ID to get a ref for.
11556
- *
11557
- * @return {RefObject} A ref containing the element.
11558
- */
11559
 
11560
- function useBlockRef(clientId) {
11561
- const {
11562
- refs
11563
- } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs);
11564
- const freshClientId = (0,external_wp_element_namespaceObject.useRef)();
11565
- freshClientId.current = clientId; // Always return an object, even if no ref exists for a given client ID, so
11566
- // that `current` works at a later point.
11567
 
11568
- return (0,external_wp_element_namespaceObject.useMemo)(() => ({
11569
- get current() {
11570
- let element = null; // Multiple refs may be created for a single block. Find the
11571
- // first that has an element set.
11572
 
11573
- for (const [ref, id] of refs.entries()) {
11574
- if (id === freshClientId.current && ref.current) {
11575
- element = ref.current;
 
 
 
 
 
 
 
 
 
 
11576
  }
11577
  }
 
11578
 
11579
- return element;
 
11580
  }
11581
 
11582
- }), []);
11583
- }
11584
- /**
11585
- * Return the element for a given client ID. Updates whenever the element
11586
- * changes, becomes available, or disappears.
11587
- *
11588
- * @param {string} clientId The client ID to an element for.
11589
- *
11590
- * @return {Element|null} The block's wrapper element.
11591
- */
11592
 
 
 
 
 
 
11593
 
11594
- function useBlockElement(clientId) {
11595
- const {
11596
- callbacks
11597
- } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs);
11598
- const ref = useBlockRef(clientId);
11599
- const [element, setElement] = (0,external_wp_element_namespaceObject.useState)(null);
11600
- (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
11601
- if (!clientId) {
11602
- return;
11603
  }
 
11604
 
11605
- callbacks.set(setElement, clientId);
11606
- return () => {
11607
- callbacks.delete(setElement);
11608
- };
11609
- }, [clientId]);
11610
- return ref.current || element;
11611
  }
11612
 
 
 
 
 
 
 
 
 
 
11613
 
 
 
 
11614
 
11615
- //# sourceMappingURL=use-block-refs.js.map
11616
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/color-panel.js
11617
-
11618
-
11619
- /**
11620
- * WordPress dependencies
11621
- */
11622
 
 
 
 
 
 
11623
 
11624
- /**
11625
- * Internal dependencies
11626
- */
 
 
 
 
11627
 
 
 
11628
 
 
 
 
 
 
 
11629
 
 
 
 
11630
 
 
11631
 
 
 
 
11632
 
11633
- function getComputedStyle(node) {
11634
- return node.ownerDocument.defaultView.getComputedStyle(node);
11635
- }
 
 
 
11636
 
11637
- function ColorPanel({
11638
- settings,
11639
- clientId,
11640
- enableContrastChecking = true,
11641
- showTitle = true
11642
- }) {
11643
- const [detectedBackgroundColor, setDetectedBackgroundColor] = (0,external_wp_element_namespaceObject.useState)();
11644
- const [detectedColor, setDetectedColor] = (0,external_wp_element_namespaceObject.useState)();
11645
- const ref = useBlockRef(clientId);
11646
- (0,external_wp_element_namespaceObject.useEffect)(() => {
11647
- if (!enableContrastChecking) {
11648
- return;
 
 
 
 
 
 
 
 
 
 
11649
  }
 
11650
 
11651
- if (!ref.current) {
11652
- return;
 
 
 
11653
  }
 
11654
 
11655
- setDetectedColor(getComputedStyle(ref.current).color);
11656
- let backgroundColorNode = ref.current;
11657
- let backgroundColor = getComputedStyle(backgroundColorNode).backgroundColor;
 
11658
 
11659
- while (backgroundColor === 'rgba(0, 0, 0, 0)' && backgroundColorNode.parentNode && backgroundColorNode.parentNode.nodeType === backgroundColorNode.parentNode.ELEMENT_NODE) {
11660
- backgroundColorNode = backgroundColorNode.parentNode;
11661
- backgroundColor = getComputedStyle(backgroundColorNode).backgroundColor;
 
11662
  }
 
11663
 
11664
- setDetectedBackgroundColor(backgroundColor);
11665
- });
11666
- return (0,external_wp_element_namespaceObject.createElement)(inspector_controls, null, (0,external_wp_element_namespaceObject.createElement)(panel_color_gradient_settings, {
11667
- title: (0,external_wp_i18n_namespaceObject.__)('Color'),
11668
- initialOpen: false,
11669
- settings: settings,
11670
- showTitle: showTitle
11671
- }, enableContrastChecking && (0,external_wp_element_namespaceObject.createElement)(contrast_checker, {
11672
- backgroundColor: detectedBackgroundColor,
11673
- textColor: detectedColor
11674
- })));
11675
  }
11676
- //# sourceMappingURL=color-panel.js.map
11677
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/color.js
11678
 
 
 
 
 
11679
 
 
 
 
11680
 
11681
- /**
11682
- * External dependencies
11683
- */
11684
 
 
 
11685
 
11686
- /**
11687
- * WordPress dependencies
11688
- */
11689
 
 
 
 
 
 
11690
 
 
 
 
 
11691
 
 
 
 
 
11692
 
 
 
 
 
11693
 
 
 
 
 
 
 
11694
 
11695
- /**
11696
- * Internal dependencies
11697
- */
11698
 
 
 
11699
 
 
 
 
 
 
 
 
 
 
11700
 
 
 
11701
 
 
 
 
11702
 
 
11703
 
11704
- const COLOR_SUPPORT_KEY = 'color';
11705
- const color_EMPTY_ARRAY = [];
 
 
11706
 
11707
- const hasColorSupport = blockType => {
11708
- const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY);
11709
- return colorSupport && (colorSupport.link === true || colorSupport.gradient === true || colorSupport.background !== false || colorSupport.text !== false);
11710
- };
 
 
11711
 
11712
- const color_shouldSkipSerialization = blockType => {
11713
- const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY);
11714
- return colorSupport === null || colorSupport === void 0 ? void 0 : colorSupport.__experimentalSkipSerialization;
 
 
 
 
 
 
 
 
 
 
 
 
11715
  };
11716
 
11717
- const hasLinkColorSupport = blockType => {
11718
- if (external_wp_element_namespaceObject.Platform.OS !== 'web') {
11719
- return false;
 
11720
  }
11721
 
11722
- const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY);
11723
- return (0,external_lodash_namespaceObject.isObject)(colorSupport) && !!colorSupport.link;
11724
- };
 
 
11725
 
11726
- const hasGradientSupport = blockType => {
11727
- const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY);
11728
- return (0,external_lodash_namespaceObject.isObject)(colorSupport) && !!colorSupport.gradients;
11729
- };
11730
 
11731
- const hasBackgroundColorSupport = blockType => {
11732
- const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY);
11733
- return colorSupport && colorSupport.background !== false;
11734
- };
 
 
 
 
 
 
11735
 
11736
- const hasTextColorSupport = blockType => {
11737
- const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY);
11738
- return colorSupport && colorSupport.text !== false;
11739
- };
11740
- /**
11741
- * Filters registered block settings, extending attributes to include
11742
- * `backgroundColor` and `textColor` attribute.
11743
- *
11744
- * @param {Object} settings Original block settings.
11745
- *
11746
- * @return {Object} Filtered block settings.
11747
- */
11748
 
 
 
11749
 
11750
- function color_addAttributes(settings) {
11751
- if (!hasColorSupport(settings)) {
11752
- return settings;
11753
- } // allow blocks to specify their own attribute definition with default values if needed.
 
 
 
 
 
 
 
11754
 
 
 
11755
 
11756
- if (!settings.attributes.backgroundColor) {
11757
- Object.assign(settings.attributes, {
11758
- backgroundColor: {
11759
- type: 'string'
11760
- }
11761
- });
11762
- }
11763
 
11764
- if (!settings.attributes.textColor) {
11765
- Object.assign(settings.attributes, {
11766
- textColor: {
11767
- type: 'string'
11768
- }
11769
- });
11770
- }
11771
 
11772
- if (hasGradientSupport(settings) && !settings.attributes.gradient) {
11773
- Object.assign(settings.attributes, {
11774
- gradient: {
11775
- type: 'string'
11776
- }
11777
- });
11778
- }
11779
 
11780
- return settings;
11781
- }
11782
- /**
11783
- * Override props assigned to save component to inject colors classnames.
11784
- *
11785
- * @param {Object} props Additional props applied to save element.
11786
- * @param {Object} blockType Block type.
11787
- * @param {Object} attributes Block attributes.
11788
- *
11789
- * @return {Object} Filtered props applied to save element.
11790
- */
11791
 
 
11792
 
11793
- function color_addSaveProps(props, blockType, attributes) {
11794
- var _style$color, _style$color2, _style$color3, _style$color4, _style$elements, _style$elements$link;
11795
 
11796
- if (!hasColorSupport(blockType) || color_shouldSkipSerialization(blockType)) {
11797
- return props;
11798
- }
11799
 
11800
- const hasGradient = hasGradientSupport(blockType); // I'd have prefered to avoid the "style" attribute usage here
11801
 
11802
- const {
11803
- backgroundColor,
11804
- textColor,
11805
- gradient,
11806
- style
11807
- } = attributes;
11808
- const backgroundClass = getColorClassName('background-color', backgroundColor);
11809
 
11810
- const gradientClass = __experimentalGetGradientClass(gradient);
11811
 
11812
- const textClass = getColorClassName('color', textColor);
11813
- const newClassName = classnames_default()(props.className, textClass, gradientClass, {
11814
- // Don't apply the background class if there's a custom gradient
11815
- [backgroundClass]: (!hasGradient || !(style !== null && style !== void 0 && (_style$color = style.color) !== null && _style$color !== void 0 && _style$color.gradient)) && !!backgroundClass,
11816
- 'has-text-color': textColor || (style === null || style === void 0 ? void 0 : (_style$color2 = style.color) === null || _style$color2 === void 0 ? void 0 : _style$color2.text),
11817
- 'has-background': backgroundColor || (style === null || style === void 0 ? void 0 : (_style$color3 = style.color) === null || _style$color3 === void 0 ? void 0 : _style$color3.background) || hasGradient && (gradient || (style === null || style === void 0 ? void 0 : (_style$color4 = style.color) === null || _style$color4 === void 0 ? void 0 : _style$color4.gradient)),
11818
- 'has-link-color': style === null || style === void 0 ? void 0 : (_style$elements = style.elements) === null || _style$elements === void 0 ? void 0 : (_style$elements$link = _style$elements.link) === null || _style$elements$link === void 0 ? void 0 : _style$elements$link.color
11819
- });
11820
- props.className = newClassName ? newClassName : undefined;
11821
- return props;
11822
- }
11823
- /**
11824
- * Filters registered block settings to extand the block edit wrapper
11825
- * to apply the desired styles and classnames properly.
11826
- *
11827
- * @param {Object} settings Original block settings.
11828
- *
11829
- * @return {Object} Filtered block settings.
11830
- */
11831
 
11832
- function color_addEditProps(settings) {
11833
- if (!hasColorSupport(settings) || color_shouldSkipSerialization(settings)) {
11834
- return settings;
11835
- }
11836
 
11837
- const existingGetEditWrapperProps = settings.getEditWrapperProps;
11838
 
11839
- settings.getEditWrapperProps = attributes => {
11840
- let props = {};
11841
 
11842
- if (existingGetEditWrapperProps) {
11843
- props = existingGetEditWrapperProps(attributes);
 
 
 
 
 
 
 
 
 
11844
  }
11845
 
11846
- return color_addSaveProps(props, settings, attributes);
11847
  };
11848
 
11849
- return settings;
11850
  }
11851
 
11852
- const getLinkColorFromAttributeValue = (colors, value) => {
11853
- const attributeParsed = /var:preset\|color\|(.+)/.exec(value);
 
 
 
 
11854
 
11855
- if (attributeParsed && attributeParsed[1]) {
11856
- return getColorObjectByAttributeValues(colors, attributeParsed[1]).color;
11857
- }
11858
 
11859
- return value;
11860
- };
11861
 
11862
- function immutableSet(object, path, value) {
11863
- return (0,external_lodash_namespaceObject.setWith)(object ? (0,external_lodash_namespaceObject.clone)(object) : {}, path, value, external_lodash_namespaceObject.clone);
11864
- }
11865
- /**
11866
- * Inspector control panel containing the color related configuration
11867
- *
11868
- * @param {Object} props
11869
- *
11870
- * @return {WPElement} Color edit element.
11871
- */
11872
 
 
11873
 
11874
- function ColorEdit(props) {
11875
- var _style$color6, _style$color7, _style$color8, _style$elements2, _style$elements2$link, _style$elements2$link2, _style$elements3, _style$elements3$link, _style$elements3$link2;
11876
 
11877
- const {
11878
- name: blockName,
11879
- attributes
11880
- } = props;
11881
- const solids = useSetting('color.palette') || color_EMPTY_ARRAY;
11882
- const gradients = useSetting('color.gradients') || color_EMPTY_ARRAY;
11883
- const areCustomSolidsEnabled = useSetting('color.custom');
11884
- const areCustomGradientsEnabled = useSetting('color.customGradient');
11885
- const isLinkEnabled = useSetting('color.link');
11886
- const isTextEnabled = useSetting('color.text');
11887
- const isBackgroundEnabled = useSetting('color.background'); // Shouldn't be needed but right now the ColorGradientsPanel
11888
- // can trigger both onChangeColor and onChangeBackground
11889
- // synchronously causing our two callbacks to override changes
11890
- // from each other.
11891
 
11892
- const localAttributes = (0,external_wp_element_namespaceObject.useRef)(attributes);
11893
- (0,external_wp_element_namespaceObject.useEffect)(() => {
11894
- localAttributes.current = attributes;
11895
- }, [attributes]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11896
 
11897
- if (!hasColorSupport(blockName)) {
11898
- return null;
 
 
 
 
 
 
 
 
 
 
11899
  }
 
11900
 
11901
- const hasLinkColor = hasLinkColorSupport(blockName) && isLinkEnabled && (solids.length > 0 || areCustomSolidsEnabled);
11902
- const hasTextColor = hasTextColorSupport(blockName) && isTextEnabled && (solids.length > 0 || areCustomSolidsEnabled);
11903
- const hasBackgroundColor = hasBackgroundColorSupport(blockName) && isBackgroundEnabled && (solids.length > 0 || areCustomSolidsEnabled);
11904
- const hasGradientColor = hasGradientSupport(blockName) && (gradients.length > 0 || areCustomGradientsEnabled);
11905
 
11906
- if (!hasLinkColor && !hasTextColor && !hasBackgroundColor && !hasGradientColor) {
11907
- return null;
 
 
 
 
11908
  }
11909
 
11910
- const {
11911
- style,
11912
- textColor,
11913
- backgroundColor,
11914
- gradient
11915
- } = attributes;
11916
- let gradientValue;
 
 
 
 
11917
 
11918
- if (hasGradientColor && gradient) {
11919
- gradientValue = getGradientValueBySlug(gradients, gradient);
11920
- } else if (hasGradientColor) {
11921
- var _style$color5;
 
 
 
11922
 
11923
- gradientValue = style === null || style === void 0 ? void 0 : (_style$color5 = style.color) === null || _style$color5 === void 0 ? void 0 : _style$color5.gradient;
11924
- }
 
 
 
 
11925
 
11926
- const onChangeColor = name => value => {
11927
- var _localAttributes$curr, _localAttributes$curr2;
 
 
 
11928
 
11929
- const colorObject = getColorObjectByColorValue(solids, value);
11930
- const attributeName = name + 'Color';
11931
- const newStyle = { ...localAttributes.current.style,
11932
- color: { ...((_localAttributes$curr = localAttributes.current) === null || _localAttributes$curr === void 0 ? void 0 : (_localAttributes$curr2 = _localAttributes$curr.style) === null || _localAttributes$curr2 === void 0 ? void 0 : _localAttributes$curr2.color),
11933
- [name]: colorObject !== null && colorObject !== void 0 && colorObject.slug ? undefined : value
11934
- }
11935
- };
11936
- const newNamedColor = colorObject !== null && colorObject !== void 0 && colorObject.slug ? colorObject.slug : undefined;
11937
- const newAttributes = {
11938
- style: cleanEmptyObject(newStyle),
11939
- [attributeName]: newNamedColor
11940
- };
11941
- props.setAttributes(newAttributes);
11942
- localAttributes.current = { ...localAttributes.current,
11943
- ...newAttributes
11944
- };
11945
- };
11946
-
11947
- const onChangeGradient = value => {
11948
- const slug = getGradientSlugByValue(gradients, value);
11949
- let newAttributes;
11950
 
11951
- if (slug) {
11952
- var _localAttributes$curr3, _localAttributes$curr4, _localAttributes$curr5;
 
 
 
 
11953
 
11954
- const newStyle = { ...((_localAttributes$curr3 = localAttributes.current) === null || _localAttributes$curr3 === void 0 ? void 0 : _localAttributes$curr3.style),
11955
- color: { ...((_localAttributes$curr4 = localAttributes.current) === null || _localAttributes$curr4 === void 0 ? void 0 : (_localAttributes$curr5 = _localAttributes$curr4.style) === null || _localAttributes$curr5 === void 0 ? void 0 : _localAttributes$curr5.color),
11956
- gradient: undefined
 
11957
  }
11958
- };
11959
- newAttributes = {
11960
- style: cleanEmptyObject(newStyle),
11961
- gradient: slug
11962
- };
11963
  } else {
11964
- var _localAttributes$curr6, _localAttributes$curr7, _localAttributes$curr8;
 
 
11965
 
11966
- const newStyle = { ...((_localAttributes$curr6 = localAttributes.current) === null || _localAttributes$curr6 === void 0 ? void 0 : _localAttributes$curr6.style),
11967
- color: { ...((_localAttributes$curr7 = localAttributes.current) === null || _localAttributes$curr7 === void 0 ? void 0 : (_localAttributes$curr8 = _localAttributes$curr7.style) === null || _localAttributes$curr8 === void 0 ? void 0 : _localAttributes$curr8.color),
11968
- gradient: value
 
 
 
 
 
 
 
11969
  }
11970
- };
11971
- newAttributes = {
11972
- style: cleanEmptyObject(newStyle),
11973
- gradient: undefined
11974
- };
11975
  }
11976
-
11977
- props.setAttributes(newAttributes);
11978
- localAttributes.current = { ...localAttributes.current,
11979
- ...newAttributes
11980
- };
11981
- };
11982
-
11983
- const onChangeLinkColor = value => {
11984
- const colorObject = getColorObjectByColorValue(solids, value);
11985
- const newLinkColorValue = colorObject !== null && colorObject !== void 0 && colorObject.slug ? `var:preset|color|${colorObject.slug}` : value;
11986
- const newStyle = cleanEmptyObject(immutableSet(style, ['elements', 'link', 'color', 'text'], newLinkColorValue));
11987
- props.setAttributes({
11988
- style: newStyle
11989
- });
11990
- };
11991
-
11992
- return (0,external_wp_element_namespaceObject.createElement)(ColorPanel, {
11993
- enableContrastChecking: // Turn on contrast checker for web only since it's not supported on mobile yet.
11994
- external_wp_element_namespaceObject.Platform.OS === 'web' && !gradient && !(style !== null && style !== void 0 && (_style$color6 = style.color) !== null && _style$color6 !== void 0 && _style$color6.gradient),
11995
- clientId: props.clientId,
11996
- settings: [...(hasTextColor ? [{
11997
- label: (0,external_wp_i18n_namespaceObject.__)('Text color'),
11998
- onColorChange: onChangeColor('text'),
11999
- colorValue: getColorObjectByAttributeValues(solids, textColor, style === null || style === void 0 ? void 0 : (_style$color7 = style.color) === null || _style$color7 === void 0 ? void 0 : _style$color7.text).color
12000
- }] : []), ...(hasBackgroundColor || hasGradientColor ? [{
12001
- label: (0,external_wp_i18n_namespaceObject.__)('Background color'),
12002
- onColorChange: hasBackgroundColor ? onChangeColor('background') : undefined,
12003
- colorValue: getColorObjectByAttributeValues(solids, backgroundColor, style === null || style === void 0 ? void 0 : (_style$color8 = style.color) === null || _style$color8 === void 0 ? void 0 : _style$color8.background).color,
12004
- gradientValue,
12005
- onGradientChange: hasGradientColor ? onChangeGradient : undefined
12006
- }] : []), ...(hasLinkColor ? [{
12007
- label: (0,external_wp_i18n_namespaceObject.__)('Link Color'),
12008
- onColorChange: onChangeLinkColor,
12009
- colorValue: getLinkColorFromAttributeValue(solids, style === null || style === void 0 ? void 0 : (_style$elements2 = style.elements) === null || _style$elements2 === void 0 ? void 0 : (_style$elements2$link = _style$elements2.link) === null || _style$elements2$link === void 0 ? void 0 : (_style$elements2$link2 = _style$elements2$link.color) === null || _style$elements2$link2 === void 0 ? void 0 : _style$elements2$link2.text),
12010
- clearable: !!(style !== null && style !== void 0 && (_style$elements3 = style.elements) !== null && _style$elements3 !== void 0 && (_style$elements3$link = _style$elements3.link) !== null && _style$elements3$link !== void 0 && (_style$elements3$link2 = _style$elements3$link.color) !== null && _style$elements3$link2 !== void 0 && _style$elements3$link2.text)
12011
- }] : [])]
12012
  });
12013
  }
12014
- /**
12015
- * This adds inline styles for color palette colors.
12016
- * Ideally, this is not needed and themes should load their palettes on the editor.
12017
- *
12018
- * @param {Function} BlockListBlock Original component.
12019
- *
12020
- * @return {Function} Wrapped component.
12021
- */
12022
-
12023
- const withColorPaletteStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockListBlock => props => {
12024
- var _getColorObjectByAttr, _getColorObjectByAttr2, _props$wrapperProps;
12025
-
12026
- const {
12027
- name,
12028
- attributes
12029
- } = props;
12030
- const {
12031
- backgroundColor,
12032
- textColor
12033
- } = attributes;
12034
- const colors = useSetting('color.palette') || color_EMPTY_ARRAY;
12035
 
12036
- if (!hasColorSupport(name) || color_shouldSkipSerialization(name)) {
12037
- return (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, props);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12038
  }
 
12039
 
12040
- const extraStyles = {
12041
- color: textColor ? (_getColorObjectByAttr = getColorObjectByAttributeValues(colors, textColor)) === null || _getColorObjectByAttr === void 0 ? void 0 : _getColorObjectByAttr.color : undefined,
12042
- backgroundColor: backgroundColor ? (_getColorObjectByAttr2 = getColorObjectByAttributeValues(colors, backgroundColor)) === null || _getColorObjectByAttr2 === void 0 ? void 0 : _getColorObjectByAttr2.color : undefined
12043
- };
12044
- let wrapperProps = props.wrapperProps;
12045
- wrapperProps = { ...props.wrapperProps,
12046
- style: { ...extraStyles,
12047
- ...((_props$wrapperProps = props.wrapperProps) === null || _props$wrapperProps === void 0 ? void 0 : _props$wrapperProps.style)
12048
- }
12049
- };
12050
- return (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, _extends({}, props, {
12051
- wrapperProps: wrapperProps
12052
- }));
12053
  });
12054
- (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/color/addAttribute', color_addAttributes);
12055
- (0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/color/addSaveProps', color_addSaveProps);
12056
- (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/color/addEditProps', color_addEditProps);
12057
- (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/color/with-color-palette-styles', withColorPaletteStyles);
12058
- //# sourceMappingURL=color.js.map
12059
- ;// CONCATENATED MODULE: ./packages/icons/build-module/library/format-underline.js
12060
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12061
 
12062
- /**
12063
- * WordPress dependencies
12064
- */
 
 
 
 
12065
 
12066
- const formatUnderline = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
12067
- xmlns: "http://www.w3.org/2000/svg",
12068
- viewBox: "0 0 24 24"
12069
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
12070
- d: "M7 18v1h10v-1H7zm5-2c1.5 0 2.6-.4 3.4-1.2.8-.8 1.1-2 1.1-3.5V5H15v5.8c0 1.2-.2 2.1-.6 2.8-.4.7-1.2 1-2.4 1s-2-.3-2.4-1c-.4-.7-.6-1.6-.6-2.8V5H7.5v6.2c0 1.5.4 2.7 1.1 3.5.8.9 1.9 1.3 3.4 1.3z"
12071
- }));
12072
- /* harmony default export */ var format_underline = (formatUnderline);
12073
- //# sourceMappingURL=format-underline.js.map
12074
- ;// CONCATENATED MODULE: ./packages/icons/build-module/library/format-strikethrough.js
12075
 
 
 
 
 
 
12076
 
12077
- /**
12078
- * WordPress dependencies
12079
- */
 
 
12080
 
12081
- const formatStrikethrough = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
12082
- xmlns: "http://www.w3.org/2000/svg",
12083
- viewBox: "0 0 24 24"
12084
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
12085
- d: "M9.1 9v-.5c0-.6.2-1.1.7-1.4.5-.3 1.2-.5 2-.5.7 0 1.4.1 2.1.3.7.2 1.4.5 2.1.9l.2-1.9c-.6-.3-1.2-.5-1.9-.7-.8-.1-1.6-.2-2.4-.2-1.5 0-2.7.3-3.6 1-.8.7-1.2 1.5-1.2 2.6V9h2zM20 12H4v1h8.3c.3.1.6.2.8.3.5.2.9.5 1.1.8.3.3.4.7.4 1.2 0 .7-.2 1.1-.8 1.5-.5.3-1.2.5-2.1.5-.8 0-1.6-.1-2.4-.3-.8-.2-1.5-.5-2.2-.8L7 18.1c.5.2 1.2.4 2 .6.8.2 1.6.3 2.4.3 1.7 0 3-.3 3.9-1 .9-.7 1.3-1.6 1.3-2.8 0-.9-.2-1.7-.7-2.2H20v-1z"
12086
- }));
12087
- /* harmony default export */ var format_strikethrough = (formatStrikethrough);
12088
- //# sourceMappingURL=format-strikethrough.js.map
12089
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/text-decoration-control/index.js
12090
 
 
 
12091
 
12092
- /**
12093
- * WordPress dependencies
12094
- */
 
 
12095
 
 
 
 
 
12096
 
 
 
 
 
 
12097
 
12098
- const TEXT_DECORATIONS = [{
12099
- name: (0,external_wp_i18n_namespaceObject.__)('Underline'),
12100
- value: 'underline',
12101
- icon: format_underline
12102
- }, {
12103
- name: (0,external_wp_i18n_namespaceObject.__)('Strikethrough'),
12104
- value: 'line-through',
12105
- icon: format_strikethrough
12106
- }];
12107
- /**
12108
- * Control to facilitate text decoration selections.
12109
- *
12110
- * @param {Object} props Component props.
12111
- * @param {string} props.value Currently selected text decoration.
12112
- * @param {Function} props.onChange Handles change in text decoration selection.
12113
- *
12114
- * @return {WPElement} Text decoration control.
12115
- */
12116
 
12117
- function TextDecorationControl({
12118
- value,
12119
- onChange
12120
- }) {
12121
- return (0,external_wp_element_namespaceObject.createElement)("fieldset", {
12122
- className: "block-editor-text-decoration-control"
12123
- }, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_i18n_namespaceObject.__)('Decoration')), (0,external_wp_element_namespaceObject.createElement)("div", {
12124
- className: "block-editor-text-decoration-control__buttons"
12125
- }, TEXT_DECORATIONS.map(textDecoration => {
12126
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
12127
- key: textDecoration.value,
12128
- icon: textDecoration.icon,
12129
- isSmall: true,
12130
- isPressed: textDecoration.value === value,
12131
- onClick: () => onChange(textDecoration.value === value ? undefined : textDecoration.value),
12132
- "aria-label": textDecoration.name
12133
- });
12134
- })));
12135
  }
12136
- //# sourceMappingURL=index.js.map
12137
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/text-decoration.js
12138
 
 
 
 
 
 
 
 
 
 
12139
 
12140
- /**
12141
- * WordPress dependencies
12142
- */
12143
-
12144
- /**
12145
- * Internal dependencies
12146
- */
12147
 
 
 
 
 
 
 
12148
 
 
12149
 
 
 
 
12150
 
12151
- /**
12152
- * Key within block settings' supports array indicating support for text
12153
- * decorations e.g. settings found in `block.json`.
12154
- */
12155
 
12156
- const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
12157
- /**
12158
- * Inspector control panel containing the text decoration options.
12159
- *
12160
- * @param {Object} props Block properties.
12161
- *
12162
- * @return {WPElement} Text decoration edit element.
12163
- */
12164
 
12165
- function TextDecorationEdit(props) {
12166
- var _style$typography;
 
 
 
 
12167
 
12168
- const {
12169
- attributes: {
12170
- style
12171
- },
12172
- setAttributes
12173
- } = props;
12174
- const isDisabled = useIsTextDecorationDisabled(props);
 
 
12175
 
12176
- if (isDisabled) {
12177
- return null;
12178
- }
12179
 
12180
- function onChange(newDecoration) {
12181
- setAttributes({
12182
- style: cleanEmptyObject({ ...style,
12183
- typography: { ...(style === null || style === void 0 ? void 0 : style.typography),
12184
- textDecoration: newDecoration
12185
- }
12186
- })
12187
- });
12188
- }
12189
 
12190
- return (0,external_wp_element_namespaceObject.createElement)(TextDecorationControl, {
12191
- value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.textDecoration,
12192
- onChange: onChange
 
 
 
 
 
 
12193
  });
12194
  }
12195
- /**
12196
- * Checks if text-decoration settings have been disabled.
12197
- *
12198
- * @param {string} name Name of the block.
12199
- *
12200
- * @return {boolean} Whether or not the setting is disabled.
12201
- */
12202
-
12203
- function useIsTextDecorationDisabled({
12204
- name: blockName
12205
- } = {}) {
12206
- const notSupported = !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, TEXT_DECORATION_SUPPORT_KEY);
12207
- const hasTextDecoration = useSetting('typography.customTextDecorations');
12208
- return notSupported || !hasTextDecoration;
12209
- }
12210
- //# sourceMappingURL=text-decoration.js.map
12211
- ;// CONCATENATED MODULE: ./packages/icons/build-module/library/format-uppercase.js
12212
-
12213
 
12214
- /**
12215
- * WordPress dependencies
12216
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12217
 
12218
- const formatUppercase = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
12219
- xmlns: "http://www.w3.org/2000/svg",
12220
- viewBox: "0 0 24 24"
12221
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
12222
- d: "M6.1 6.8L2.1 18h1.6l1.1-3h4.3l1.1 3h1.6l-4-11.2H6.1zm-.8 6.8L7 8.9l1.7 4.7H5.3zm15.1-.7c-.4-.5-.9-.8-1.6-1 .4-.2.7-.5.8-.9.2-.4.3-.9.3-1.4 0-.9-.3-1.6-.8-2-.6-.5-1.3-.7-2.4-.7h-3.5V18h4.2c1.1 0 2-.3 2.6-.8.6-.6 1-1.4 1-2.4-.1-.8-.3-1.4-.6-1.9zm-5.7-4.7h1.8c.6 0 1.1.1 1.4.4.3.2.5.7.5 1.3 0 .6-.2 1.1-.5 1.3-.3.2-.8.4-1.4.4h-1.8V8.2zm4 8c-.4.3-.9.5-1.5.5h-2.6v-3.8h2.6c1.4 0 2 .6 2 1.9.1.6-.1 1-.5 1.4z"
12223
- }));
12224
- /* harmony default export */ var format_uppercase = (formatUppercase);
12225
- //# sourceMappingURL=format-uppercase.js.map
12226
- ;// CONCATENATED MODULE: ./packages/icons/build-module/library/format-lowercase.js
 
12227
 
 
 
 
12228
 
12229
- /**
12230
- * WordPress dependencies
12231
- */
 
 
 
 
12232
 
12233
- const formatLowercase = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
12234
- xmlns: "http://www.w3.org/2000/svg",
12235
- viewBox: "0 0 24 24"
12236
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
12237
- d: "M11 16.8c-.1-.1-.2-.3-.3-.5v-2.6c0-.9-.1-1.7-.3-2.2-.2-.5-.5-.9-.9-1.2-.4-.2-.9-.3-1.6-.3-.5 0-1 .1-1.5.2s-.9.3-1.2.6l.2 1.2c.4-.3.7-.4 1.1-.5.3-.1.7-.2 1-.2.6 0 1 .1 1.3.4.3.2.4.7.4 1.4-1.2 0-2.3.2-3.3.7s-1.4 1.1-1.4 2.1c0 .7.2 1.2.7 1.6.4.4 1 .6 1.8.6.9 0 1.7-.4 2.4-1.2.1.3.2.5.4.7.1.2.3.3.6.4.3.1.6.1 1.1.1h.1l.2-1.2h-.1c-.4.1-.6 0-.7-.1zM9.2 16c-.2.3-.5.6-.9.8-.3.1-.7.2-1.1.2-.4 0-.7-.1-.9-.3-.2-.2-.3-.5-.3-.9 0-.6.2-1 .7-1.3.5-.3 1.3-.4 2.5-.5v2zm10.6-3.9c-.3-.6-.7-1.1-1.2-1.5-.6-.4-1.2-.6-1.9-.6-.5 0-.9.1-1.4.3-.4.2-.8.5-1.1.8V6h-1.4v12h1.3l.2-1c.2.4.6.6 1 .8.4.2.9.3 1.4.3.7 0 1.2-.2 1.8-.5.5-.4 1-.9 1.3-1.5.3-.6.5-1.3.5-2.1-.1-.6-.2-1.3-.5-1.9zm-1.7 4c-.4.5-.9.8-1.6.8s-1.2-.2-1.7-.7c-.4-.5-.7-1.2-.7-2.1 0-.9.2-1.6.7-2.1.4-.5 1-.7 1.7-.7s1.2.3 1.6.8c.4.5.6 1.2.6 2s-.2 1.4-.6 2z"
12238
- }));
12239
- /* harmony default export */ var format_lowercase = (formatLowercase);
12240
- //# sourceMappingURL=format-lowercase.js.map
12241
- ;// CONCATENATED MODULE: ./packages/icons/build-module/library/format-capitalize.js
12242
 
 
 
 
 
 
 
12243
 
12244
- /**
12245
- * WordPress dependencies
12246
- */
 
 
 
 
 
 
 
12247
 
12248
- const formatCapitalize = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
12249
- xmlns: "http://www.w3.org/2000/svg",
12250
- viewBox: "0 0 24 24"
12251
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
12252
- d: "M7.1 6.8L3.1 18h1.6l1.1-3h4.3l1.1 3h1.6l-4-11.2H7.1zm-.8 6.8L8 8.9l1.7 4.7H6.3zm14.5-1.5c-.3-.6-.7-1.1-1.2-1.5-.6-.4-1.2-.6-1.9-.6-.5 0-.9.1-1.4.3-.4.2-.8.5-1.1.8V6h-1.4v12h1.3l.2-1c.2.4.6.6 1 .8.4.2.9.3 1.4.3.7 0 1.2-.2 1.8-.5.5-.4 1-.9 1.3-1.5.3-.6.5-1.3.5-2.1-.1-.6-.2-1.3-.5-1.9zm-1.7 4c-.4.5-.9.8-1.6.8s-1.2-.2-1.7-.7c-.4-.5-.7-1.2-.7-2.1 0-.9.2-1.6.7-2.1.4-.5 1-.7 1.7-.7s1.2.3 1.6.8c.4.5.6 1.2.6 2 .1.8-.2 1.4-.6 2z"
12253
- }));
12254
- /* harmony default export */ var format_capitalize = (formatCapitalize);
12255
- //# sourceMappingURL=format-capitalize.js.map
12256
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/text-transform-control/index.js
 
 
 
12257
 
 
 
 
 
 
12258
 
12259
- /**
12260
- * WordPress dependencies
12261
- */
12262
 
 
12263
 
 
 
 
 
12264
 
12265
- const TEXT_TRANSFORMS = [{
12266
- name: (0,external_wp_i18n_namespaceObject.__)('Uppercase'),
12267
- value: 'uppercase',
12268
- icon: format_uppercase
12269
- }, {
12270
- name: (0,external_wp_i18n_namespaceObject.__)('Lowercase'),
12271
- value: 'lowercase',
12272
- icon: format_lowercase
12273
- }, {
12274
- name: (0,external_wp_i18n_namespaceObject.__)('Capitalize'),
12275
- value: 'capitalize',
12276
- icon: format_capitalize
12277
- }];
12278
- /**
12279
- * Control to facilitate text transform selections.
12280
- *
12281
- * @param {Object} props Component props.
12282
- * @param {string} props.value Currently selected text transform.
12283
- * @param {Function} props.onChange Handles change in text transform selection.
12284
- *
12285
- * @return {WPElement} Text transform control.
12286
- */
12287
 
12288
- function TextTransformControl({
12289
- value,
12290
- onChange
12291
- }) {
12292
- return (0,external_wp_element_namespaceObject.createElement)("fieldset", {
12293
- className: "block-editor-text-transform-control"
12294
- }, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_i18n_namespaceObject.__)('Letter case')), (0,external_wp_element_namespaceObject.createElement)("div", {
12295
- className: "block-editor-text-transform-control__buttons"
12296
- }, TEXT_TRANSFORMS.map(textTransform => {
12297
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
12298
- key: textTransform.value,
12299
- icon: textTransform.icon,
12300
- isSmall: true,
12301
- isPressed: value === textTransform.value,
12302
- "aria-label": textTransform.name,
12303
- onClick: () => onChange(value === textTransform.value ? undefined : textTransform.value)
12304
- });
12305
- })));
12306
- }
12307
- //# sourceMappingURL=index.js.map
12308
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/text-transform.js
12309
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12310
 
12311
- /**
12312
- * WordPress dependencies
12313
- */
 
 
12314
 
12315
- /**
12316
- * Internal dependencies
12317
- */
 
 
 
 
 
 
 
 
 
 
 
 
12318
 
 
 
 
 
 
 
12319
 
 
12320
 
 
 
 
 
 
 
 
 
 
12321
 
12322
- /**
12323
- * Key within block settings' supports array indicating support for text
12324
- * transforms e.g. settings found in `block.json`.
12325
- */
12326
 
12327
- const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';
12328
- /**
12329
- * Inspector control panel containing the text transform options.
12330
- *
12331
- * @param {Object} props Block properties.
12332
- *
12333
- * @return {WPElement} Text transform edit element.
12334
- */
12335
 
12336
- function TextTransformEdit(props) {
12337
- var _style$typography;
 
12338
 
12339
- const {
12340
- attributes: {
12341
- style
12342
- },
12343
- setAttributes
12344
- } = props;
12345
- const isDisabled = useIsTextTransformDisabled(props);
12346
 
12347
- if (isDisabled) {
12348
- return null;
12349
  }
12350
 
12351
- function onChange(newTransform) {
12352
- setAttributes({
12353
- style: cleanEmptyObject({ ...style,
12354
- typography: { ...(style === null || style === void 0 ? void 0 : style.typography),
12355
- textTransform: newTransform
12356
- }
12357
- })
12358
- });
12359
  }
12360
 
12361
- return (0,external_wp_element_namespaceObject.createElement)(TextTransformControl, {
12362
- value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.textTransform,
12363
- onChange: onChange
12364
- });
12365
- }
12366
- /**
12367
- * Checks if text-transform settings have been disabled.
12368
- *
12369
- * @param {string} name Name of the block.
12370
- *
12371
- * @return {boolean} Whether or not the setting is disabled.
12372
- */
12373
 
12374
- function useIsTextTransformDisabled({
12375
- name: blockName
12376
- } = {}) {
12377
- const notSupported = !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, TEXT_TRANSFORM_SUPPORT_KEY);
12378
- const hasTextTransforms = useSetting('typography.customTextTransforms');
12379
- return notSupported || !hasTextTransforms;
12380
- }
12381
- //# sourceMappingURL=text-transform.js.map
12382
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/text-decoration-and-transform/index.js
12383
 
 
 
 
12384
 
12385
- /**
12386
- * Internal dependencies
12387
- */
12388
 
 
12389
 
12390
- /**
12391
- * Handles grouping related text decoration and text transform edit components
12392
- * so they can be laid out in a more flexible manner within the Typography
12393
- * InspectorControls panel.
12394
- *
12395
- * @param {Object} props Block props to be passed on to individual controls.
12396
- *
12397
- * @return {WPElement} Component containing text decoration or transform controls.
12398
- */
12399
 
12400
- function TextDecorationAndTransformEdit(props) {
12401
- const decorationAvailable = !useIsTextDecorationDisabled(props);
12402
- const transformAvailable = !useIsTextTransformDisabled(props);
 
12403
 
12404
- if (!decorationAvailable && !transformAvailable) {
12405
- return null;
 
 
 
12406
  }
12407
 
12408
- return (0,external_wp_element_namespaceObject.createElement)("div", {
12409
- className: "block-editor-text-decoration-and-transform"
12410
- }, decorationAvailable && (0,external_wp_element_namespaceObject.createElement)(TextDecorationEdit, props), transformAvailable && (0,external_wp_element_namespaceObject.createElement)(TextTransformEdit, props));
12411
  }
12412
- //# sourceMappingURL=index.js.map
12413
- ;// CONCATENATED MODULE: external ["wp","keycodes"]
12414
- var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
12415
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/line-height-control/utils.js
12416
- const BASE_DEFAULT_VALUE = 1.5;
12417
- const STEP = 0.1;
12418
- /**
12419
- * There are varying value types within LineHeightControl:
12420
- *
12421
- * {undefined} Initial value. No changes from the user.
12422
- * {string} Input value. Value consumed/outputted by the input. Empty would be ''.
12423
- * {number} Block attribute type. Input value needs to be converted for attribute setting.
12424
- *
12425
- * Note: If the value is undefined, the input requires it to be an empty string ('')
12426
- * in order to be considered "controlled" by props (rather than internal state).
12427
- */
12428
 
12429
- const RESET_VALUE = '';
12430
- /**
12431
- * Determines if the lineHeight attribute has been properly defined.
12432
- *
12433
- * @param {any} lineHeight The value to check.
12434
- *
12435
- * @return {boolean} Whether the lineHeight attribute is valid.
12436
- */
 
12437
 
12438
- function isLineHeightDefined(lineHeight) {
12439
- return lineHeight !== undefined && lineHeight !== RESET_VALUE;
12440
- }
12441
- //# sourceMappingURL=utils.js.map
12442
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/line-height-control/index.js
 
 
 
 
 
 
 
 
 
 
 
 
12443
 
 
 
 
 
12444
 
12445
- /**
12446
- * WordPress dependencies
12447
- */
12448
 
 
 
 
12449
 
 
 
 
12450
 
12451
- /**
12452
- * Internal dependencies
12453
- */
12454
 
 
 
 
 
12455
 
12456
- function LineHeightControl({
12457
- value: lineHeight,
12458
- onChange
12459
- }) {
12460
- const isDefined = isLineHeightDefined(lineHeight);
12461
 
12462
- const handleOnKeyDown = event => {
12463
- const {
12464
- keyCode
12465
- } = event;
12466
 
12467
- if (keyCode === external_wp_keycodes_namespaceObject.ZERO && !isDefined) {
12468
- /**
12469
- * Prevents the onChange callback from firing, which prevents
12470
- * the logic from assuming the change was triggered from
12471
- * an input arrow CLICK.
12472
- */
12473
- event.preventDefault();
12474
- onChange('0');
 
 
 
 
 
 
 
 
12475
  }
12476
- };
12477
 
12478
- const handleOnChange = nextValue => {
12479
- // Set the next value without modification if lineHeight has been defined
12480
- if (isDefined) {
12481
- onChange(nextValue);
12482
- return;
12483
- } // Otherwise...
12484
 
12485
- /**
12486
- * The following logic handles the initial up/down arrow CLICK of the
12487
- * input element. This is so that the next values (from an undefined value state)
12488
- * are more better suited for line-height rendering.
12489
- */
12490
 
 
 
 
 
12491
 
12492
- let adjustedNextValue = nextValue;
 
 
 
12493
 
12494
- switch (nextValue) {
12495
- case `${STEP}`:
12496
- // Increment by step value
12497
- adjustedNextValue = BASE_DEFAULT_VALUE + STEP;
12498
- break;
12499
 
12500
- case '0':
12501
- // Decrement by step value
12502
- adjustedNextValue = BASE_DEFAULT_VALUE - STEP;
12503
- break;
12504
- }
12505
 
12506
- onChange(adjustedNextValue);
12507
- };
 
 
 
12508
 
12509
- const value = isDefined ? lineHeight : RESET_VALUE;
12510
- return (0,external_wp_element_namespaceObject.createElement)("div", {
12511
- className: "block-editor-line-height-control"
12512
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
12513
- autoComplete: "off",
12514
- onKeyDown: handleOnKeyDown,
12515
- onChange: handleOnChange,
12516
- label: (0,external_wp_i18n_namespaceObject.__)('Line height'),
12517
- placeholder: BASE_DEFAULT_VALUE,
12518
- step: STEP,
12519
- type: "number",
12520
- value: value,
12521
- min: 0
12522
- }));
12523
- }
12524
- //# sourceMappingURL=index.js.map
12525
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/line-height.js
12526
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12527
 
12528
- /**
12529
- * WordPress dependencies
12530
- */
12531
 
12532
- /**
12533
- * Internal dependencies
12534
- */
12535
 
 
 
 
 
12536
 
 
 
12537
 
 
 
 
 
 
12538
 
12539
- const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';
12540
- /**
12541
- * Inspector control panel containing the line height related configuration
12542
- *
12543
- * @param {Object} props
12544
- *
12545
- * @return {WPElement} Line height edit element.
12546
- */
12547
 
12548
- function LineHeightEdit(props) {
12549
- var _style$typography;
12550
 
12551
- const {
12552
- attributes: {
12553
- style
12554
- }
12555
- } = props;
12556
- const isDisabled = useIsLineHeightDisabled(props);
12557
 
12558
- if (isDisabled) {
12559
- return null;
12560
- }
12561
 
12562
- const onChange = newLineHeightValue => {
12563
- const newStyle = { ...style,
12564
- typography: { ...(style === null || style === void 0 ? void 0 : style.typography),
12565
- lineHeight: newLineHeightValue
 
 
 
 
12566
  }
12567
- };
12568
- props.setAttributes({
12569
- style: cleanEmptyObject(newStyle)
12570
  });
12571
- };
 
12572
 
12573
- return (0,external_wp_element_namespaceObject.createElement)(LineHeightControl, {
12574
- value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.lineHeight,
12575
- onChange: onChange
12576
- });
12577
- }
12578
- /**
12579
- * Custom hook that checks if line-height settings have been disabled.
12580
- *
12581
- * @param {string} name The name of the block.
12582
- * @return {boolean} Whether setting is disabled.
12583
- */
12584
 
12585
- function useIsLineHeightDisabled({
12586
- name: blockName
12587
- } = {}) {
12588
- const isDisabled = !useSetting('typography.customLineHeight');
12589
- return !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, LINE_HEIGHT_SUPPORT_KEY) || isDisabled;
12590
- }
12591
- //# sourceMappingURL=line-height.js.map
12592
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/font-appearance-control/index.js
12593
 
 
 
 
 
12594
 
12595
- /**
12596
- * WordPress dependencies
12597
- */
 
 
12598
 
 
 
 
12599
 
 
12600
 
12601
- const FONT_STYLES = [{
12602
- name: (0,external_wp_i18n_namespaceObject.__)('Regular'),
12603
- value: 'normal'
12604
- }, {
12605
- name: (0,external_wp_i18n_namespaceObject.__)('Italic'),
12606
- value: 'italic'
12607
- }];
12608
- const FONT_WEIGHTS = [{
12609
- name: (0,external_wp_i18n_namespaceObject.__)('Thin'),
12610
- value: '100'
12611
- }, {
12612
- name: (0,external_wp_i18n_namespaceObject.__)('Extra Light'),
12613
- value: '200'
12614
- }, {
12615
- name: (0,external_wp_i18n_namespaceObject.__)('Light'),
12616
- value: '300'
12617
- }, {
12618
- name: (0,external_wp_i18n_namespaceObject.__)('Regular'),
12619
- value: '400'
12620
- }, {
12621
- name: (0,external_wp_i18n_namespaceObject.__)('Medium'),
12622
- value: '500'
12623
- }, {
12624
- name: (0,external_wp_i18n_namespaceObject.__)('Semi Bold'),
12625
- value: '600'
12626
- }, {
12627
- name: (0,external_wp_i18n_namespaceObject.__)('Bold'),
12628
- value: '700'
12629
- }, {
12630
- name: (0,external_wp_i18n_namespaceObject.__)('Extra Bold'),
12631
- value: '800'
12632
- }, {
12633
- name: (0,external_wp_i18n_namespaceObject.__)('Black'),
12634
- value: '900'
12635
- }];
12636
- /**
12637
- * Control to display unified font style and weight options.
12638
- *
12639
- * @param {Object} props Component props.
12640
- *
12641
- * @return {WPElement} Font appearance control.
12642
- */
12643
 
12644
- function FontAppearanceControl(props) {
12645
- const {
12646
- onChange,
12647
- hasFontStyles = true,
12648
- hasFontWeights = true,
12649
- value: {
12650
- fontStyle,
12651
- fontWeight
12652
- }
12653
- } = props;
12654
- const hasStylesOrWeights = hasFontStyles || hasFontWeights;
12655
- const defaultOption = {
12656
- key: 'default',
12657
- name: (0,external_wp_i18n_namespaceObject.__)('Default'),
12658
- style: {
12659
- fontStyle: undefined,
12660
- fontWeight: undefined
12661
- }
12662
- }; // Combines both font style and weight options into a single dropdown.
12663
 
12664
- const combineOptions = () => {
12665
- const combinedOptions = [defaultOption];
12666
- FONT_STYLES.forEach(({
12667
- name: styleName,
12668
- value: styleValue
12669
- }) => {
12670
- FONT_WEIGHTS.forEach(({
12671
- name: weightName,
12672
- value: weightValue
12673
- }) => {
12674
- const optionName = styleValue === 'normal' ? weightName : (0,external_wp_i18n_namespaceObject.sprintf)(
12675
- /* translators: 1: Font weight name. 2: Font style name. */
12676
- (0,external_wp_i18n_namespaceObject.__)('%1$s %2$s'), weightName, styleName);
12677
- combinedOptions.push({
12678
- key: `${styleValue}-${weightValue}`,
12679
- name: optionName,
12680
- style: {
12681
- fontStyle: styleValue,
12682
- fontWeight: weightValue
12683
- }
12684
- });
12685
- });
12686
  });
12687
- return combinedOptions;
12688
- }; // Generates select options for font styles only.
12689
 
 
 
 
 
 
 
 
 
12690
 
12691
- const styleOptions = () => {
12692
- const combinedOptions = [defaultOption];
12693
- FONT_STYLES.forEach(({
12694
- name,
12695
- value
12696
- }) => {
12697
- combinedOptions.push({
12698
- key: value,
12699
- name,
12700
- style: {
12701
- fontStyle: value,
12702
- fontWeight: undefined
12703
  }
 
 
12704
  });
12705
- });
12706
- return combinedOptions;
12707
- }; // Generates select options for font weights only.
12708
 
 
 
12709
 
12710
- const weightOptions = () => {
12711
- const combinedOptions = [defaultOption];
12712
- FONT_WEIGHTS.forEach(({
12713
- name,
12714
- value
12715
- }) => {
12716
- combinedOptions.push({
12717
- key: value,
12718
- name,
12719
- style: {
12720
- fontStyle: undefined,
12721
- fontWeight: value
12722
- }
12723
- });
12724
- });
12725
- return combinedOptions;
12726
- }; // Map font styles and weights to select options.
12727
 
 
 
12728
 
12729
- const selectOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
12730
- if (hasFontStyles && hasFontWeights) {
12731
- return combineOptions();
 
 
 
 
12732
  }
12733
 
12734
- return hasFontStyles ? styleOptions() : weightOptions();
12735
- }, [props.options]); // Find current selection by comparing font style & weight against options,
12736
- // and fall back to the Default option if there is no matching option.
12737
-
12738
- const currentSelection = selectOptions.find(option => option.style.fontStyle === fontStyle && option.style.fontWeight === fontWeight) || selectOptions[0]; // Adjusts field label in case either styles or weights are disabled.
12739
 
12740
- const getLabel = () => {
12741
- if (!hasFontStyles) {
12742
- return (0,external_wp_i18n_namespaceObject.__)('Font weight');
12743
- }
12744
 
12745
- if (!hasFontWeights) {
12746
- return (0,external_wp_i18n_namespaceObject.__)('Font style');
12747
- }
12748
 
12749
- return (0,external_wp_i18n_namespaceObject.__)('Appearance');
12750
- }; // Adjusts screen reader description based on styles or weights.
 
 
12751
 
 
 
 
 
 
12752
 
12753
- const getDescribedBy = () => {
12754
- if (!currentSelection) {
12755
- return (0,external_wp_i18n_namespaceObject.__)('No selected font appearance');
 
 
12756
  }
 
12757
 
12758
- if (!hasFontStyles) {
12759
- return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected font weight.
12760
- (0,external_wp_i18n_namespaceObject.__)('Currently selected font weight: %s'), currentSelection.name);
12761
- }
 
 
 
12762
 
12763
- if (!hasFontWeights) {
12764
- return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected font style.
12765
- (0,external_wp_i18n_namespaceObject.__)('Currently selected font style: %s'), currentSelection.name);
12766
  }
12767
 
12768
- return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected font appearance.
12769
- (0,external_wp_i18n_namespaceObject.__)('Currently selected font appearance: %s'), currentSelection.name);
12770
- };
12771
-
12772
- return (0,external_wp_element_namespaceObject.createElement)("fieldset", {
12773
- className: "components-font-appearance-control"
12774
- }, hasStylesOrWeights && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CustomSelectControl, {
12775
- className: "components-font-appearance-control__select",
12776
- label: getLabel(),
12777
- describedBy: getDescribedBy(),
12778
- options: selectOptions,
12779
- value: currentSelection,
12780
- onChange: ({
12781
- selectedItem
12782
- }) => onChange(selectedItem.style)
12783
- }));
12784
- }
12785
- //# sourceMappingURL=index.js.map
12786
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/font-appearance.js
12787
 
 
 
 
12788
 
12789
- /**
12790
- * WordPress dependencies
12791
- */
 
12792
 
12793
- /**
12794
- * Internal dependencies
12795
- */
12796
 
 
 
 
 
 
 
12797
 
 
 
12798
 
 
 
12799
 
12800
- /**
12801
- * Key within block settings' support array indicating support for font style.
12802
- */
 
 
 
 
12803
 
12804
- const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';
12805
- /**
12806
- * Key within block settings' support array indicating support for font weight.
12807
- */
12808
 
12809
- const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';
12810
- /**
12811
- * Inspector control panel containing the font appearance options.
12812
- *
12813
- * @param {Object} props Block properties.
12814
- *
12815
- * @return {WPElement} Font appearance edit element.
12816
- */
12817
 
12818
- function FontAppearanceEdit(props) {
12819
- var _style$typography, _style$typography2;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12820
 
12821
- const {
12822
- attributes: {
12823
- style
12824
- },
12825
- setAttributes
12826
- } = props;
12827
- const hasFontStyles = !useIsFontStyleDisabled(props);
12828
- const hasFontWeights = !useIsFontWeightDisabled(props);
12829
 
12830
- if (!hasFontStyles && !hasFontWeights) {
12831
- return null;
12832
- }
 
 
 
 
 
 
12833
 
12834
- const onChange = newStyles => {
12835
- setAttributes({
12836
- style: cleanEmptyObject({ ...style,
12837
- typography: { ...(style === null || style === void 0 ? void 0 : style.typography),
12838
- fontStyle: newStyles.fontStyle,
12839
- fontWeight: newStyles.fontWeight
12840
  }
12841
- })
 
 
12842
  });
12843
- };
12844
 
12845
- const fontStyle = style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.fontStyle;
12846
- const fontWeight = style === null || style === void 0 ? void 0 : (_style$typography2 = style.typography) === null || _style$typography2 === void 0 ? void 0 : _style$typography2.fontWeight;
12847
- return (0,external_wp_element_namespaceObject.createElement)(FontAppearanceControl, {
12848
- onChange: onChange,
12849
- hasFontStyles: hasFontStyles,
12850
- hasFontWeights: hasFontWeights,
12851
- value: {
12852
- fontStyle,
12853
- fontWeight
12854
  }
12855
- });
12856
- }
12857
- /**
12858
- * Checks if font style support has been disabled either by not opting in for
12859
- * support or by failing to provide preset styles.
12860
- *
12861
- * @param {Object} props Block properties.
12862
- * @param {string} props.name Name for the block type.
12863
- *
12864
- * @return {boolean} Whether font style support has been disabled.
12865
- */
12866
-
12867
- function useIsFontStyleDisabled({
12868
- name: blockName
12869
- } = {}) {
12870
- const styleSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, FONT_STYLE_SUPPORT_KEY);
12871
- const hasFontStyles = useSetting('typography.customFontStyle');
12872
- return !styleSupport || !hasFontStyles;
12873
- }
12874
- /**
12875
- * Checks if font weight support has been disabled either by not opting in for
12876
- * support or by failing to provide preset weights.
12877
- *
12878
- * @param {Object} props Block properties.
12879
- * @param {string} props.name Name for the block type.
12880
- *
12881
- * @return {boolean} Whether font weight support has been disabled.
12882
- */
12883
-
12884
- function useIsFontWeightDisabled({
12885
- name: blockName
12886
- } = {}) {
12887
- const weightSupport = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, FONT_WEIGHT_SUPPORT_KEY);
12888
- const hasFontWeights = useSetting('typography.customFontWeight');
12889
- return !weightSupport || !hasFontWeights;
12890
- }
12891
- /**
12892
- * Checks if font appearance support has been disabled.
12893
- *
12894
- * @param {Object} props Block properties.
12895
- *
12896
- * @return {boolean} Whether font appearance support has been disabled.
12897
- */
12898
-
12899
- function useIsFontAppearanceDisabled(props) {
12900
- const stylesDisabled = useIsFontStyleDisabled(props);
12901
- const weightsDisabled = useIsFontWeightDisabled(props);
12902
- return stylesDisabled && weightsDisabled;
12903
- }
12904
- //# sourceMappingURL=font-appearance.js.map
12905
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/font-family/index.js
12906
-
12907
 
 
 
12908
 
12909
- /**
12910
- * External dependencies
12911
- */
 
 
 
 
12912
 
12913
- /**
12914
- * WordPress dependencies
12915
- */
 
 
 
 
 
 
 
 
 
 
12916
 
 
 
 
12917
 
 
 
12918
 
12919
- /**
12920
- * Internal dependencies
12921
- */
12922
 
 
 
12923
 
12924
- function FontFamilyControl({
12925
- value = '',
12926
- onChange,
12927
- fontFamilies,
12928
- ...props
12929
- }) {
12930
- const blockLevelFontFamilies = useSetting('typography.fontFamilies');
12931
 
12932
- if (!fontFamilies) {
12933
- fontFamilies = blockLevelFontFamilies;
12934
- }
 
 
 
 
 
12935
 
12936
- if ((0,external_lodash_namespaceObject.isEmpty)(fontFamilies)) {
12937
- return null;
12938
- }
12939
 
12940
- const options = [{
12941
- value: '',
12942
- label: (0,external_wp_i18n_namespaceObject.__)('Default')
12943
- }, ...fontFamilies.map(({
12944
- fontFamily,
12945
- name
12946
- }) => {
12947
- return {
12948
- value: fontFamily,
12949
- label: name || fontFamily
12950
- };
12951
- })];
12952
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, _extends({
12953
- label: (0,external_wp_i18n_namespaceObject.__)('Font family'),
12954
- options: options,
12955
- value: value,
12956
- onChange: onChange,
12957
- labelPosition: "top"
12958
- }, props));
12959
- }
12960
- //# sourceMappingURL=index.js.map
12961
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/font-family.js
12962
 
 
12963
 
12964
- /**
12965
- * External dependencies
12966
- */
12967
 
12968
- /**
12969
- * WordPress dependencies
12970
- */
 
 
12971
 
 
 
12972
 
12973
- /**
12974
- * Internal dependencies
12975
- */
 
 
 
12976
 
 
 
 
12977
 
 
 
12978
 
 
 
 
 
12979
 
12980
- const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';
 
 
 
12981
 
12982
- const getFontFamilyFromAttributeValue = (fontFamilies, value) => {
12983
- const attributeParsed = /var:preset\|font-family\|(.+)/.exec(value);
 
 
 
 
 
12984
 
12985
- if (attributeParsed && attributeParsed[1]) {
12986
- const fontFamilyObject = (0,external_lodash_namespaceObject.find)(fontFamilies, ({
12987
- slug
12988
- }) => {
12989
- return slug === attributeParsed[1];
12990
- });
12991
 
12992
- if (fontFamilyObject) {
12993
- return fontFamilyObject.fontFamily;
12994
- }
12995
- }
12996
 
12997
- return value;
12998
- };
 
 
12999
 
13000
- function FontFamilyEdit({
13001
- name,
13002
- setAttributes,
13003
- attributes: {
13004
- style = {}
13005
- }
13006
- }) {
13007
- var _style$typography;
13008
 
13009
- const fontFamilies = useSetting('typography.fontFamilies');
13010
- const isDisable = useIsFontFamilyDisabled({
13011
- name
13012
- });
13013
 
13014
- if (isDisable) {
13015
- return null;
13016
- }
13017
 
13018
- const value = getFontFamilyFromAttributeValue(fontFamilies, (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.fontFamily);
 
 
 
 
 
 
 
13019
 
13020
- function onChange(newValue) {
13021
- const predefinedFontFamily = (0,external_lodash_namespaceObject.find)(fontFamilies, ({
13022
- fontFamily
13023
- }) => fontFamily === newValue);
13024
- setAttributes({
13025
- style: cleanEmptyObject({ ...style,
13026
- typography: { ...(style.typography || {}),
13027
- fontFamily: predefinedFontFamily ? `var:preset|font-family|${predefinedFontFamily.slug}` : newValue || undefined
13028
- }
13029
- })
13030
- });
13031
- }
13032
 
13033
- return (0,external_wp_element_namespaceObject.createElement)(FontFamilyControl, {
13034
- className: "block-editor-hooks-font-family-control",
13035
- fontFamilies: fontFamilies,
13036
- value: value,
13037
- onChange: onChange
13038
- });
13039
- }
13040
- /**
13041
- * Custom hook that checks if font-family functionality is disabled.
13042
- *
13043
- * @param {string} name The name of the block.
13044
- * @return {boolean} Whether setting is disabled.
13045
- */
13046
 
13047
- function useIsFontFamilyDisabled({
13048
- name
13049
- }) {
13050
- const fontFamilies = useSetting('typography.fontFamilies');
13051
- return !fontFamilies || fontFamilies.length === 0 || !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, FONT_FAMILY_SUPPORT_KEY);
13052
- }
13053
- //# sourceMappingURL=font-family.js.map
13054
- ;// CONCATENATED MODULE: external ["wp","tokenList"]
13055
- var external_wp_tokenList_namespaceObject = window["wp"]["tokenList"];
13056
- var external_wp_tokenList_default = /*#__PURE__*/__webpack_require__.n(external_wp_tokenList_namespaceObject);
13057
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/font-sizes/utils.js
13058
- /**
13059
- * External dependencies
13060
- */
13061
 
13062
- /**
13063
- * Returns the font size object based on an array of named font sizes and the namedFontSize and customFontSize values.
13064
- * If namedFontSize is undefined or not found in fontSizes an object with just the size value based on customFontSize is returned.
13065
- *
13066
- * @param {Array} fontSizes Array of font size objects containing at least the "name" and "size" values as properties.
13067
- * @param {?string} fontSizeAttribute Content of the font size attribute (slug).
13068
- * @param {?number} customFontSizeAttribute Contents of the custom font size attribute (value).
13069
- *
13070
- * @return {?Object} If fontSizeAttribute is set and an equal slug is found in fontSizes it returns the font size object for that slug.
13071
- * Otherwise, an object with just the size value based on customFontSize is returned.
13072
- */
13073
 
13074
- const getFontSize = (fontSizes, fontSizeAttribute, customFontSizeAttribute) => {
13075
- if (fontSizeAttribute) {
13076
- const fontSizeObject = (0,external_lodash_namespaceObject.find)(fontSizes, {
13077
- slug: fontSizeAttribute
13078
- });
13079
 
13080
- if (fontSizeObject) {
13081
- return fontSizeObject;
 
13082
  }
13083
  }
13084
 
13085
- return {
13086
- size: customFontSizeAttribute
13087
- };
13088
- };
13089
- /**
13090
- * Returns the corresponding font size object for a given value.
13091
- *
13092
- * @param {Array} fontSizes Array of font size objects.
13093
- * @param {number} value Font size value.
13094
- *
13095
- * @return {Object} Font size object.
13096
- */
13097
 
13098
- function getFontSizeObjectByValue(fontSizes, value) {
13099
- const fontSizeObject = (0,external_lodash_namespaceObject.find)(fontSizes, {
13100
- size: value
13101
- });
13102
 
13103
- if (fontSizeObject) {
13104
- return fontSizeObject;
 
 
 
 
13105
  }
13106
 
13107
- return {
13108
- size: value
13109
- };
13110
- }
13111
- /**
13112
- * Returns a class based on fontSizeName.
13113
- *
13114
- * @param {string} fontSizeSlug Slug of the fontSize.
13115
- *
13116
- * @return {string} String with the class corresponding to the fontSize passed.
13117
- * The class is generated by appending 'has-' followed by fontSizeSlug in kebabCase and ending with '-font-size'.
13118
- */
13119
 
13120
- function getFontSizeClass(fontSizeSlug) {
13121
- if (!fontSizeSlug) {
13122
- return;
13123
  }
13124
 
13125
- return `has-${(0,external_lodash_namespaceObject.kebabCase)(fontSizeSlug)}-font-size`;
13126
- }
13127
- //# sourceMappingURL=utils.js.map
13128
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/font-sizes/font-size-picker.js
13129
-
13130
 
 
 
13131
 
13132
- /**
13133
- * WordPress dependencies
13134
- */
13135
 
13136
- /**
13137
- * Internal dependencies
13138
- */
 
 
13139
 
 
 
 
 
 
 
 
13140
 
 
 
13141
 
13142
- function FontSizePicker(props) {
13143
- const fontSizes = useSetting('typography.fontSizes');
13144
- const disableCustomFontSizes = !useSetting('typography.customFontSize');
13145
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FontSizePicker, _extends({}, props, {
13146
- fontSizes: fontSizes,
13147
- disableCustomFontSizes: disableCustomFontSizes
13148
- }));
13149
- }
13150
 
13151
- /* harmony default export */ var font_size_picker = (FontSizePicker);
13152
- //# sourceMappingURL=font-size-picker.js.map
13153
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/font-size.js
 
 
13154
 
 
 
 
13155
 
13156
- /**
13157
- * WordPress dependencies
13158
- */
13159
 
 
13160
 
 
 
13161
 
 
 
 
13162
 
13163
- /**
13164
- * Internal dependencies
13165
- */
13166
 
 
 
13167
 
 
 
 
 
 
13168
 
 
 
 
 
 
 
 
13169
 
13170
- const FONT_SIZE_SUPPORT_KEY = 'typography.fontSize';
13171
- /**
13172
- * Filters registered block settings, extending attributes to include
13173
- * `fontSize` and `fontWeight` attributes.
13174
- *
13175
- * @param {Object} settings Original block settings.
13176
- *
13177
- * @return {Object} Filtered block settings.
13178
- */
13179
 
13180
- function font_size_addAttributes(settings) {
13181
- if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, FONT_SIZE_SUPPORT_KEY)) {
13182
- return settings;
13183
- } // Allow blocks to specify a default value if needed.
13184
 
 
 
 
 
 
 
13185
 
13186
- if (!settings.attributes.fontSize) {
13187
- Object.assign(settings.attributes, {
13188
- fontSize: {
13189
- type: 'string'
13190
  }
13191
- });
13192
  }
13193
 
13194
- return settings;
13195
  }
13196
- /**
13197
- * Override props assigned to save component to inject font size.
13198
- *
13199
- * @param {Object} props Additional props applied to save element.
13200
- * @param {Object} blockType Block type.
13201
- * @param {Object} attributes Block attributes.
13202
- *
13203
- * @return {Object} Filtered props applied to save element.
13204
- */
13205
-
13206
-
13207
- function font_size_addSaveProps(props, blockType, attributes) {
13208
- if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, FONT_SIZE_SUPPORT_KEY)) {
13209
- return props;
13210
- }
13211
 
13212
- if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'typography.__experimentalSkipSerialization')) {
13213
- return props;
13214
- } // Use TokenList to dedupe classes.
 
 
13215
 
 
 
13216
 
13217
- const classes = new (external_wp_tokenList_default())(props.className);
13218
- classes.add(getFontSizeClass(attributes.fontSize));
13219
- const newClassName = classes.value;
13220
- props.className = newClassName ? newClassName : undefined;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13221
  return props;
13222
  }
13223
- /**
13224
- * Filters registered block settings to expand the block edit wrapper
13225
- * by applying the desired styles and classnames.
13226
- *
13227
- * @param {Object} settings Original block settings.
13228
- *
13229
- * @return {Object} Filtered block settings.
13230
- */
13231
-
13232
 
13233
- function font_size_addEditProps(settings) {
13234
- if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, FONT_SIZE_SUPPORT_KEY)) {
13235
- return settings;
13236
  }
13237
 
13238
- const existingGetEditWrapperProps = settings.getEditWrapperProps;
 
13239
 
13240
- settings.getEditWrapperProps = attributes => {
13241
- let props = {};
 
13242
 
13243
- if (existingGetEditWrapperProps) {
13244
- props = existingGetEditWrapperProps(attributes);
13245
- }
13246
 
13247
- return font_size_addSaveProps(props, settings, attributes);
13248
- };
 
13249
 
13250
- return settings;
13251
- }
13252
- /**
13253
- * Inspector control panel containing the font size related configuration
13254
- *
13255
- * @param {Object} props
13256
- *
13257
- * @return {WPElement} Font size edit element.
13258
- */
13259
 
 
 
 
13260
 
13261
- function FontSizeEdit(props) {
13262
- var _style$typography, _style$typography2;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13263
 
13264
- const {
13265
- attributes: {
13266
- fontSize,
13267
- style
13268
- },
13269
- setAttributes
13270
- } = props;
13271
- const isDisabled = useIsFontSizeDisabled(props);
13272
- const fontSizes = useSetting('typography.fontSizes');
13273
 
13274
- const onChange = value => {
13275
- const fontSizeSlug = getFontSizeObjectByValue(fontSizes, value).slug;
13276
- setAttributes({
13277
- style: cleanEmptyObject({ ...style,
13278
- typography: { ...(style === null || style === void 0 ? void 0 : style.typography),
13279
- fontSize: fontSizeSlug ? undefined : value
13280
- }
13281
- }),
13282
- fontSize: fontSizeSlug
13283
- });
13284
- };
13285
 
13286
- if (isDisabled) {
13287
- return null;
13288
  }
13289
 
13290
- const fontSizeObject = getFontSize(fontSizes, fontSize, style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.fontSize);
13291
- const fontSizeValue = (fontSizeObject === null || fontSizeObject === void 0 ? void 0 : fontSizeObject.size) || (style === null || style === void 0 ? void 0 : (_style$typography2 = style.typography) === null || _style$typography2 === void 0 ? void 0 : _style$typography2.fontSize) || fontSize;
13292
- return (0,external_wp_element_namespaceObject.createElement)(font_size_picker, {
13293
- onChange: onChange,
13294
- value: fontSizeValue
13295
- });
13296
- }
13297
- /**
13298
- * Custom hook that checks if font-size settings have been disabled.
13299
- *
13300
- * @param {string} name The name of the block.
13301
- * @return {boolean} Whether setting is disabled.
13302
- */
13303
 
13304
- function useIsFontSizeDisabled({
13305
- name: blockName
13306
- } = {}) {
13307
- const fontSizes = useSetting('typography.fontSizes');
13308
- const hasFontSizes = !!(fontSizes !== null && fontSizes !== void 0 && fontSizes.length);
13309
- return !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, FONT_SIZE_SUPPORT_KEY) || !hasFontSizes;
13310
- }
13311
- /**
13312
- * Add inline styles for font sizes.
13313
- * Ideally, this is not needed and themes load the font-size classes on the
13314
- * editor.
13315
- *
13316
- * @param {Function} BlockListBlock Original component.
13317
- *
13318
- * @return {Function} Wrapped component.
13319
- */
13320
 
13321
- const withFontSizeInlineStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockListBlock => props => {
13322
- var _style$typography3, _style$typography4;
 
 
 
13323
 
13324
- const fontSizes = useSetting('typography.fontSizes');
13325
- const {
13326
- name: blockName,
13327
- attributes: {
13328
- fontSize,
13329
- style
13330
- },
13331
- wrapperProps
13332
- } = props; // Only add inline styles if the block supports font sizes,
13333
- // doesn't skip serialization of font sizes,
13334
- // doesn't already have an inline font size,
13335
- // and does have a class to extract the font size from.
13336
 
13337
- if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, FONT_SIZE_SUPPORT_KEY) || (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'typography.__experimentalSkipSerialization') || !fontSize || style !== null && style !== void 0 && (_style$typography3 = style.typography) !== null && _style$typography3 !== void 0 && _style$typography3.fontSize) {
13338
- return (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, props);
 
 
13339
  }
13340
 
13341
- const fontSizeValue = getFontSize(fontSizes, fontSize, style === null || style === void 0 ? void 0 : (_style$typography4 = style.typography) === null || _style$typography4 === void 0 ? void 0 : _style$typography4.fontSize).size;
13342
- const newProps = { ...props,
13343
- wrapperProps: { ...wrapperProps,
13344
- style: {
13345
- fontSize: fontSizeValue,
13346
- ...(wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.style)
13347
- }
13348
  }
13349
- };
13350
- return (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, newProps);
13351
- }, 'withFontSizeInlineStyles');
13352
- (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/font/addAttribute', font_size_addAttributes);
13353
- (0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/font/addSaveProps', font_size_addSaveProps);
13354
- (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/font/addEditProps', font_size_addEditProps);
13355
- (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/font-size/with-font-size-inline-styles', withFontSizeInlineStyles);
13356
- //# sourceMappingURL=font-size.js.map
13357
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/letter-spacing-control/index.js
13358
 
 
 
13359
 
13360
- /**
13361
- * WordPress dependencies
13362
- */
 
13363
 
 
 
 
 
 
13364
 
13365
- /**
13366
- * Internal dependencies
13367
- */
13368
 
 
 
 
13369
 
13370
- /**
13371
- * Control for letter-spacing.
13372
- *
13373
- * @param {Object} props Component props.
13374
- * @param {string} props.value Currently selected letter-spacing.
13375
- * @param {Function} props.onChange Handles change in letter-spacing selection.
13376
- * @return {WPElement} Letter-spacing control.
13377
- */
13378
 
13379
- function LetterSpacingControl({
13380
- value,
13381
- onChange
13382
- }) {
13383
- const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
13384
- availableUnits: useSetting('spacing.units') || ['px', 'em', 'rem'],
13385
- defaultValues: {
13386
- px: '2',
13387
- em: '.2',
13388
- rem: '.2'
13389
  }
13390
- });
13391
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
13392
- label: (0,external_wp_i18n_namespaceObject.__)('Letter-spacing'),
13393
- value: value,
13394
- __unstableInputWidth: "60px",
13395
- units: units,
13396
- onChange: onChange
13397
- });
13398
- }
13399
- //# sourceMappingURL=index.js.map
13400
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/letter-spacing.js
13401
 
 
 
13402
 
13403
- /**
13404
- * WordPress dependencies
13405
- */
 
 
 
 
 
 
13406
 
13407
- /**
13408
- * Internal dependencies
13409
- */
13410
 
 
 
 
 
 
 
 
 
 
13411
 
 
 
13412
 
 
 
 
13413
 
13414
- /**
13415
- * Key within block settings' supports array indicating support for letter-spacing
13416
- * e.g. settings found in `block.json`.
13417
- */
 
 
 
 
13418
 
13419
- const LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';
13420
- /**
13421
- * Inspector control panel containing the letter-spacing options.
13422
- *
13423
- * @param {Object} props Block properties.
13424
- * @return {WPElement} Letter-spacing edit element.
13425
- */
13426
 
13427
- function LetterSpacingEdit(props) {
13428
- var _style$typography;
13429
 
13430
- const {
13431
- attributes: {
13432
- style
13433
- },
13434
- setAttributes
13435
- } = props;
13436
- const isDisabled = useIsLetterSpacingDisabled(props);
13437
 
13438
- if (isDisabled) {
13439
- return null;
 
 
 
 
 
13440
  }
13441
 
13442
- function onChange(newSpacing) {
13443
- setAttributes({
13444
- style: cleanEmptyObject({ ...style,
13445
- typography: { ...(style === null || style === void 0 ? void 0 : style.typography),
13446
- letterSpacing: newSpacing
13447
- }
13448
- })
13449
- });
 
 
 
 
13450
  }
13451
 
13452
- return (0,external_wp_element_namespaceObject.createElement)(LetterSpacingControl, {
13453
- value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.letterSpacing,
13454
- onChange: onChange
13455
- });
13456
  }
13457
- /**
13458
- * Checks if letter-spacing settings have been disabled.
13459
- *
13460
- * @param {string} name Name of the block.
13461
- * @return {boolean} Whether or not the setting is disabled.
13462
- */
13463
-
13464
- function useIsLetterSpacingDisabled({
13465
- name: blockName
13466
- } = {}) {
13467
- const notSupported = !(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, LETTER_SPACING_SUPPORT_KEY);
13468
- const hasLetterSpacing = useSetting('typography.customLetterSpacing');
13469
- return notSupported || !hasLetterSpacing;
13470
  }
13471
- //# sourceMappingURL=letter-spacing.js.map
13472
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/typography.js
13473
-
 
 
 
 
 
 
 
13474
 
13475
- /**
13476
- * WordPress dependencies
13477
- */
13478
 
13479
- /**
13480
- * External dependencies
13481
- */
13482
 
 
 
 
13483
 
 
 
 
 
 
 
13484
 
13485
- /**
13486
- * Internal dependencies
13487
- */
13488
 
 
 
 
 
 
13489
 
 
 
 
 
 
 
 
 
 
 
 
13490
 
 
 
 
 
 
 
13491
 
 
13492
 
 
 
 
 
 
 
13493
 
 
 
13494
 
 
 
 
 
 
 
 
13495
 
 
 
 
 
 
 
 
 
 
13496
 
 
 
 
13497
 
13498
- const TYPOGRAPHY_SUPPORT_KEY = 'typography';
13499
- const TYPOGRAPHY_SUPPORT_KEYS = [LINE_HEIGHT_SUPPORT_KEY, FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, FONT_FAMILY_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY];
13500
- function TypographyPanel(props) {
13501
- const isDisabled = useIsTypographyDisabled(props);
13502
- const isSupported = hasTypographySupport(props.name);
13503
- if (isDisabled || !isSupported) return null;
13504
- return (0,external_wp_element_namespaceObject.createElement)(inspector_controls, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
13505
- title: (0,external_wp_i18n_namespaceObject.__)('Typography')
13506
- }, (0,external_wp_element_namespaceObject.createElement)(FontFamilyEdit, props), (0,external_wp_element_namespaceObject.createElement)(FontSizeEdit, props), (0,external_wp_element_namespaceObject.createElement)(FontAppearanceEdit, props), (0,external_wp_element_namespaceObject.createElement)(LineHeightEdit, props), (0,external_wp_element_namespaceObject.createElement)(TextDecorationAndTransformEdit, props), (0,external_wp_element_namespaceObject.createElement)(LetterSpacingEdit, props)));
13507
- }
13508
 
13509
- const hasTypographySupport = blockName => {
13510
- return TYPOGRAPHY_SUPPORT_KEYS.some(key => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, key));
13511
- };
13512
 
13513
- function useIsTypographyDisabled(props = {}) {
13514
- const configs = [useIsFontAppearanceDisabled(props), useIsFontSizeDisabled(props), useIsLineHeightDisabled(props), useIsFontFamilyDisabled(props), useIsTextDecorationDisabled(props), useIsTextTransformDisabled(props), useIsLetterSpacingDisabled(props)];
13515
- return configs.filter(Boolean).length === configs.length;
13516
- }
13517
- //# sourceMappingURL=typography.js.map
13518
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/gap.js
13519
 
 
 
 
 
 
13520
 
13521
- /**
13522
- * WordPress dependencies
13523
- */
13524
 
 
 
 
 
13525
 
 
 
 
 
 
13526
 
 
 
 
 
 
13527
 
13528
- /**
13529
- * Internal dependencies
13530
- */
 
 
13531
 
 
 
 
 
 
 
 
 
 
 
 
13532
 
 
 
 
13533
 
 
 
 
13534
 
 
 
13535
 
13536
- /**
13537
- * Determines if there is gap support.
13538
- *
13539
- * @param {string|Object} blockType Block name or Block Type object.
13540
- * @return {boolean} Whether there is support.
13541
- */
13542
-
13543
- function hasGapSupport(blockType) {
13544
- const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, SPACING_SUPPORT_KEY);
13545
- return !!(true === support || support !== null && support !== void 0 && support.blockGap);
13546
- }
13547
- /**
13548
- * Checks if there is a current value in the gap block support attributes.
13549
- *
13550
- * @param {Object} props Block props.
13551
- * @return {boolean} Whether or not the block has a gap value set.
13552
- */
13553
-
13554
- function hasGapValue(props) {
13555
- var _props$attributes$sty, _props$attributes$sty2;
13556
-
13557
- return ((_props$attributes$sty = props.attributes.style) === null || _props$attributes$sty === void 0 ? void 0 : (_props$attributes$sty2 = _props$attributes$sty.spacing) === null || _props$attributes$sty2 === void 0 ? void 0 : _props$attributes$sty2.blockGap) !== undefined;
13558
  }
13559
- /**
13560
- * Resets the gap block support attribute. This can be used when disabling
13561
- * the gap support controls for a block via a progressive discovery panel.
13562
- *
13563
- * @param {Object} props Block props.
13564
- * @param {Object} props.attributes Block's attributes.
13565
- * @param {Object} props.setAttributes Function to set block's attributes.
13566
- */
13567
 
13568
- function resetGap({
13569
- attributes = {},
13570
- setAttributes
13571
- }) {
13572
- const {
13573
- style
13574
- } = attributes;
13575
- setAttributes({
13576
- style: { ...style,
13577
- spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing),
13578
- blockGap: undefined
13579
- }
13580
- }
13581
  });
13582
  }
13583
- /**
13584
- * Custom hook that checks if gap settings have been disabled.
13585
- *
13586
- * @param {string} name The name of the block.
13587
- * @return {boolean} Whether the gap setting is disabled.
13588
- */
13589
 
13590
- function useIsGapDisabled({
13591
- name: blockName
13592
- } = {}) {
13593
- const isDisabled = !useSetting('spacing.blockGap');
13594
- return !hasGapSupport(blockName) || isDisabled;
 
 
 
 
 
 
 
 
13595
  }
13596
- /**
13597
- * Inspector control panel containing the gap related configuration
13598
- *
13599
- * @param {Object} props
13600
- *
13601
- * @return {WPElement} Gap edit element.
13602
- */
13603
 
13604
- function GapEdit(props) {
13605
- var _style$spacing;
 
 
 
 
13606
 
 
 
 
 
 
 
 
13607
  const {
13608
- clientId,
13609
- attributes: {
13610
- style
13611
- },
13612
- setAttributes
13613
- } = props;
13614
- const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
13615
- availableUnits: useSetting('spacing.units') || ['%', 'px', 'em', 'rem', 'vw']
13616
- });
13617
- const ref = useBlockRef(clientId);
13618
 
13619
- if (useIsGapDisabled(props)) {
13620
- return null;
13621
- }
 
 
 
13622
 
13623
- const onChange = next => {
13624
- var _window;
13625
 
13626
- const newStyle = { ...style,
13627
- spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing),
13628
- blockGap: next
13629
- }
13630
- };
13631
- setAttributes({
13632
- style: cleanEmptyObject(newStyle)
13633
- }); // In Safari, changing the `gap` CSS value on its own will not trigger the layout
13634
- // to be recalculated / re-rendered. To force the updated gap to re-render, here
13635
- // we replace the block's node with itself.
13636
 
13637
- const isSafari = ((_window = window) === null || _window === void 0 ? void 0 : _window.navigator.userAgent) && window.navigator.userAgent.includes('Safari') && !window.navigator.userAgent.includes('Chrome ') && !window.navigator.userAgent.includes('Chromium ');
 
 
 
 
 
 
13638
 
13639
- if (ref.current && isSafari) {
13640
- var _ref$current$parentNo;
13641
 
13642
- (_ref$current$parentNo = ref.current.parentNode) === null || _ref$current$parentNo === void 0 ? void 0 : _ref$current$parentNo.replaceChild(ref.current, ref.current);
 
 
13643
  }
13644
  };
13645
 
13646
- return external_wp_element_namespaceObject.Platform.select({
13647
- web: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
13648
- label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'),
13649
- __unstableInputWidth: "80px",
13650
- min: 0,
13651
- onChange: onChange,
13652
- units: units,
13653
- value: style === null || style === void 0 ? void 0 : (_style$spacing = style.spacing) === null || _style$spacing === void 0 ? void 0 : _style$spacing.blockGap
13654
- })),
13655
- native: null
13656
- });
13657
- }
13658
- //# sourceMappingURL=gap.js.map
13659
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/margin.js
13660
 
 
 
 
 
13661
 
13662
- /**
13663
- * WordPress dependencies
13664
- */
 
13665
 
 
 
 
13666
 
 
 
 
 
 
 
 
13667
 
 
 
 
 
 
 
 
13668
 
13669
- /**
13670
- * Internal dependencies
13671
- */
 
13672
 
 
 
 
 
13673
 
 
 
 
13674
 
 
 
 
13675
 
13676
- /**
13677
- * Determines if there is margin support.
13678
- *
13679
- * @param {string|Object} blockType Block name or Block Type object.
13680
- *
13681
- * @return {boolean} Whether there is support.
13682
- */
 
 
13683
 
13684
- function hasMarginSupport(blockType) {
13685
- const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, SPACING_SUPPORT_KEY);
13686
- return !!(true === support || support !== null && support !== void 0 && support.margin);
13687
- }
13688
- /**
13689
- * Checks if there is a current value in the margin block support attributes.
13690
- *
13691
- * @param {Object} props Block props.
13692
- * @return {boolean} Whether or not the block has a margin value set.
13693
- */
 
13694
 
13695
- function hasMarginValue(props) {
13696
- var _props$attributes$sty, _props$attributes$sty2;
 
 
 
 
 
 
 
 
 
 
 
 
 
13697
 
13698
- return ((_props$attributes$sty = props.attributes.style) === null || _props$attributes$sty === void 0 ? void 0 : (_props$attributes$sty2 = _props$attributes$sty.spacing) === null || _props$attributes$sty2 === void 0 ? void 0 : _props$attributes$sty2.margin) !== undefined;
13699
- }
13700
- /**
13701
- * Resets the margin block support attributes. This can be used when disabling
13702
- * the margin support controls for a block via a `ToolsPanel`.
13703
- *
13704
- * @param {Object} props Block props.
13705
- * @param {Object} props.attributes Block's attributes.
13706
- * @param {Object} props.setAttributes Function to set block's attributes.
13707
- */
13708
 
13709
- function resetMargin({
13710
- attributes = {},
13711
- setAttributes
13712
- }) {
13713
- const {
13714
- style
13715
- } = attributes;
13716
- setAttributes({
13717
- style: cleanEmptyObject({ ...style,
13718
- spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing),
13719
- margin: undefined
13720
  }
13721
- })
13722
- });
13723
- }
13724
- /**
13725
- * Custom hook that checks if margin settings have been disabled.
13726
- *
13727
- * @param {string} name The name of the block.
13728
- *
13729
- * @return {boolean} Whether margin setting is disabled.
13730
- */
13731
-
13732
- function useIsMarginDisabled({
13733
- name: blockName
13734
- } = {}) {
13735
- const isDisabled = !useSetting('spacing.customMargin');
13736
- const isInvalid = !useIsDimensionsSupportValid(blockName, 'margin');
13737
- return !hasMarginSupport(blockName) || isDisabled || isInvalid;
13738
- }
13739
- /**
13740
- * Inspector control panel containing the margin related configuration
13741
- *
13742
- * @param {Object} props Block props.
13743
- *
13744
- * @return {WPElement} Margin edit element.
13745
- */
13746
 
13747
- function MarginEdit(props) {
13748
- var _style$spacing;
 
 
 
 
 
 
 
 
13749
 
13750
- const {
13751
- name: blockName,
13752
- attributes: {
13753
- style
13754
- },
13755
- setAttributes
13756
- } = props;
13757
- const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
13758
- availableUnits: useSetting('spacing.units') || ['%', 'px', 'em', 'rem', 'vw']
13759
- });
13760
- const sides = useCustomSides(blockName, 'margin');
13761
- const splitOnAxis = sides && sides.some(side => AXIAL_SIDES.includes(side));
13762
 
13763
- if (useIsMarginDisabled(props)) {
13764
- return null;
13765
- }
13766
 
13767
- const onChange = next => {
13768
- const newStyle = { ...style,
13769
- spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing),
13770
- margin: next
13771
  }
13772
- };
13773
- setAttributes({
13774
- style: cleanEmptyObject(newStyle)
13775
- });
13776
- };
13777
 
13778
- const onChangeShowVisualizer = next => {
13779
- const newStyle = { ...style,
13780
- visualizers: {
13781
- margin: next
 
 
 
 
 
 
13782
  }
13783
- };
13784
- setAttributes({
13785
- style: cleanEmptyObject(newStyle)
13786
  });
13787
- };
13788
-
13789
- return external_wp_element_namespaceObject.Platform.select({
13790
- web: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, {
13791
- values: style === null || style === void 0 ? void 0 : (_style$spacing = style.spacing) === null || _style$spacing === void 0 ? void 0 : _style$spacing.margin,
13792
- onChange: onChange,
13793
- onChangeShowVisualizer: onChangeShowVisualizer,
13794
- label: (0,external_wp_i18n_namespaceObject.__)('Margin'),
13795
- sides: sides,
13796
- units: units,
13797
- allowReset: false,
13798
- splitOnAxis: splitOnAxis
13799
- })),
13800
- native: null
13801
  });
 
 
 
 
 
13802
  }
13803
- //# sourceMappingURL=margin.js.map
13804
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/padding.js
13805
-
13806
-
13807
- /**
13808
- * WordPress dependencies
13809
- */
13810
-
13811
 
 
 
 
 
 
13812
 
 
13813
 
13814
- /**
13815
- * Internal dependencies
13816
- */
13817
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13818
 
 
 
 
13819
 
 
 
 
 
 
 
13820
 
13821
- /**
13822
- * Determines if there is padding support.
13823
- *
13824
- * @param {string|Object} blockType Block name or Block Type object.
13825
- *
13826
- * @return {boolean} Whether there is support.
13827
- */
13828
 
13829
- function hasPaddingSupport(blockType) {
13830
- const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, SPACING_SUPPORT_KEY);
13831
- return !!(true === support || support !== null && support !== void 0 && support.padding);
13832
  }
13833
- /**
13834
- * Checks if there is a current value in the padding block support attributes.
13835
- *
13836
- * @param {Object} props Block props.
13837
- * @return {boolean} Whether or not the block has a padding value set.
13838
- */
13839
 
13840
- function hasPaddingValue(props) {
13841
- var _props$attributes$sty, _props$attributes$sty2;
13842
 
13843
- return ((_props$attributes$sty = props.attributes.style) === null || _props$attributes$sty === void 0 ? void 0 : (_props$attributes$sty2 = _props$attributes$sty.spacing) === null || _props$attributes$sty2 === void 0 ? void 0 : _props$attributes$sty2.padding) !== undefined;
13844
- }
13845
- /**
13846
- * Resets the padding block support attributes. This can be used when disabling
13847
- * the padding support controls for a block via a `ToolsPanel`.
13848
- *
13849
- * @param {Object} props Block props.
13850
- * @param {Object} props.attributes Block's attributes.
13851
- * @param {Object} props.setAttributes Function to set block's attributes.
13852
- */
13853
 
13854
- function resetPadding({
13855
- attributes = {},
13856
- setAttributes
13857
- }) {
13858
  const {
13859
- style
13860
- } = attributes;
13861
- setAttributes({
13862
- style: cleanEmptyObject({ ...style,
13863
- spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing),
13864
- padding: undefined
13865
- }
13866
- })
 
 
 
 
 
 
 
13867
  });
13868
- }
13869
- /**
13870
- * Custom hook that checks if padding settings have been disabled.
13871
- *
13872
- * @param {string} name The name of the block.
13873
- *
13874
- * @return {boolean} Whether padding setting is disabled.
13875
- */
13876
-
13877
- function useIsPaddingDisabled({
13878
- name: blockName
13879
- } = {}) {
13880
- const isDisabled = !useSetting('spacing.customPadding');
13881
- const isInvalid = !useIsDimensionsSupportValid(blockName, 'padding');
13882
- return !hasPaddingSupport(blockName) || isDisabled || isInvalid;
13883
- }
13884
- /**
13885
- * Inspector control panel containing the padding related configuration
13886
- *
13887
- * @param {Object} props
13888
- *
13889
- * @return {WPElement} Padding edit element.
13890
- */
13891
-
13892
- function PaddingEdit(props) {
13893
- var _style$spacing;
13894
 
13895
- const {
13896
- name: blockName,
13897
- attributes: {
13898
- style
13899
- },
13900
- setAttributes
13901
- } = props;
13902
- const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
13903
- availableUnits: useSetting('spacing.units') || ['%', 'px', 'em', 'rem', 'vw']
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13904
  });
13905
- const sides = useCustomSides(blockName, 'padding');
13906
- const splitOnAxis = sides && sides.some(side => AXIAL_SIDES.includes(side));
13907
 
13908
- if (useIsPaddingDisabled(props)) {
13909
- return null;
13910
- }
 
 
 
 
13911
 
13912
- const onChange = next => {
13913
- const newStyle = { ...style,
13914
- spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing),
13915
- padding: next
 
 
 
13916
  }
13917
- };
13918
- setAttributes({
13919
- style: cleanEmptyObject(newStyle)
13920
  });
13921
- };
13922
 
13923
- const onChangeShowVisualizer = next => {
13924
- const newStyle = { ...style,
13925
- visualizers: {
13926
- padding: next
13927
- }
13928
- };
13929
- setAttributes({
13930
- style: cleanEmptyObject(newStyle)
13931
- });
13932
- };
13933
 
13934
- return external_wp_element_namespaceObject.Platform.select({
13935
- web: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, {
13936
- values: style === null || style === void 0 ? void 0 : (_style$spacing = style.spacing) === null || _style$spacing === void 0 ? void 0 : _style$spacing.padding,
13937
- onChange: onChange,
13938
- onChangeShowVisualizer: onChangeShowVisualizer,
13939
- label: (0,external_wp_i18n_namespaceObject.__)('Padding'),
13940
- sides: sides,
13941
- units: units,
13942
- allowReset: false,
13943
- splitOnAxis: splitOnAxis
13944
- })),
13945
- native: null
13946
- });
13947
- }
13948
- //# sourceMappingURL=padding.js.map
13949
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/dimensions.js
13950
 
 
 
 
 
 
13951
 
13952
- /**
13953
- * WordPress dependencies
13954
- */
 
 
 
 
 
 
 
 
 
13955
 
 
 
 
 
13956
 
 
 
 
 
13957
 
 
13958
 
13959
- /**
13960
- * Internal dependencies
13961
- */
 
 
 
13962
 
 
 
13963
 
 
 
 
13964
 
 
 
 
13965
 
 
 
 
 
 
13966
 
13967
- const SPACING_SUPPORT_KEY = 'spacing';
13968
- const ALL_SIDES = ['top', 'right', 'bottom', 'left'];
13969
- const AXIAL_SIDES = ['vertical', 'horizontal'];
13970
- /**
13971
- * Inspector controls for dimensions support.
13972
- *
13973
- * @param {Object} props Block props.
13974
- *
13975
- * @return {WPElement} Inspector controls for spacing support features.
13976
- */
13977
 
13978
- function DimensionsPanel(props) {
13979
- const isGapDisabled = useIsGapDisabled(props);
13980
- const isPaddingDisabled = useIsPaddingDisabled(props);
13981
- const isMarginDisabled = useIsMarginDisabled(props);
13982
- const isDisabled = useIsDimensionsDisabled(props);
13983
- const isSupported = hasDimensionsSupport(props.name);
13984
 
13985
- if (isDisabled || !isSupported) {
13986
- return null;
13987
- }
13988
 
13989
- const defaultSpacingControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(props.name, [SPACING_SUPPORT_KEY, '__experimentalDefaultControls']);
 
 
13990
 
13991
- const createResetAllFilter = attribute => newAttributes => {
13992
- var _newAttributes$style;
 
 
 
 
13993
 
13994
- return { ...newAttributes,
13995
- style: { ...newAttributes.style,
13996
- spacing: { ...((_newAttributes$style = newAttributes.style) === null || _newAttributes$style === void 0 ? void 0 : _newAttributes$style.spacing),
13997
- [attribute]: undefined
13998
  }
13999
  }
14000
  };
14001
- };
14002
-
14003
- return (0,external_wp_element_namespaceObject.createElement)(inspector_controls, {
14004
- __experimentalGroup: "dimensions"
14005
- }, !isPaddingDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
14006
- hasValue: () => hasPaddingValue(props),
14007
- label: (0,external_wp_i18n_namespaceObject.__)('Padding'),
14008
- onDeselect: () => resetPadding(props),
14009
- resetAllFilter: createResetAllFilter('padding'),
14010
- isShownByDefault: defaultSpacingControls === null || defaultSpacingControls === void 0 ? void 0 : defaultSpacingControls.padding,
14011
- panelId: props.clientId
14012
- }, (0,external_wp_element_namespaceObject.createElement)(PaddingEdit, props)), !isMarginDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
14013
- hasValue: () => hasMarginValue(props),
14014
- label: (0,external_wp_i18n_namespaceObject.__)('Margin'),
14015
- onDeselect: () => resetMargin(props),
14016
- resetAllFilter: createResetAllFilter('margin'),
14017
- isShownByDefault: defaultSpacingControls === null || defaultSpacingControls === void 0 ? void 0 : defaultSpacingControls.margin,
14018
- panelId: props.clientId
14019
- }, (0,external_wp_element_namespaceObject.createElement)(MarginEdit, props)), !isGapDisabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
14020
- hasValue: () => hasGapValue(props),
14021
- label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'),
14022
- onDeselect: () => resetGap(props),
14023
- resetAllFilter: createResetAllFilter('blockGap'),
14024
- isShownByDefault: defaultSpacingControls === null || defaultSpacingControls === void 0 ? void 0 : defaultSpacingControls.blockGap,
14025
- panelId: props.clientId
14026
- }, (0,external_wp_element_namespaceObject.createElement)(GapEdit, props)));
14027
- }
14028
- /**
14029
- * Determine whether there is dimensions related block support.
14030
- *
14031
- * @param {string} blockName Block name.
14032
- *
14033
- * @return {boolean} Whether there is support.
14034
- */
14035
 
14036
- function hasDimensionsSupport(blockName) {
14037
- if (external_wp_element_namespaceObject.Platform.OS !== 'web') {
14038
- return false;
14039
- }
14040
-
14041
- return hasGapSupport(blockName) || hasPaddingSupport(blockName) || hasMarginSupport(blockName);
14042
- }
14043
- /**
14044
- * Determines whether dimensions support has been disabled.
14045
- *
14046
- * @param {Object} props Block properties.
14047
- *
14048
- * @return {boolean} If spacing support is completely disabled.
14049
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
14050
 
14051
- const useIsDimensionsDisabled = (props = {}) => {
14052
- const gapDisabled = useIsGapDisabled(props);
14053
- const paddingDisabled = useIsPaddingDisabled(props);
14054
- const marginDisabled = useIsMarginDisabled(props);
14055
- return gapDisabled && paddingDisabled && marginDisabled;
14056
- };
14057
- /**
14058
- * Custom hook to retrieve which padding/margin is supported
14059
- * e.g. top, right, bottom or left.
14060
- *
14061
- * Sides are opted into by default. It is only if a specific side is set to
14062
- * false that it is omitted.
14063
- *
14064
- * @param {string} blockName Block name.
14065
- * @param {string} feature The feature custom sides relate to e.g. padding or margins.
14066
- *
14067
- * @return {Object} Sides supporting custom margin.
14068
- */
14069
 
 
 
14070
 
14071
- function useCustomSides(blockName, feature) {
14072
- const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, SPACING_SUPPORT_KEY); // Skip when setting is boolean as theme isn't setting arbitrary sides.
 
 
 
 
 
 
14073
 
14074
- if (!support || typeof support[feature] === 'boolean') {
14075
- return;
14076
- }
 
 
 
 
 
 
 
14077
 
14078
- return support[feature];
14079
  }
14080
- /**
14081
- * Custom hook to determine whether the sides configured in the
14082
- * block support are valid. A dimension property cannot declare
14083
- * support for a mix of axial and individual sides.
14084
- *
14085
- * @param {string} blockName Block name.
14086
- * @param {string} feature The feature custom sides relate to e.g. padding or margins.
14087
- *
14088
- * @return {boolean} If the feature has a valid configuration of sides.
14089
- */
14090
 
14091
- function useIsDimensionsSupportValid(blockName, feature) {
14092
- const sides = useCustomSides(blockName, feature);
 
 
 
 
 
 
14093
 
14094
- if (sides && sides.some(side => ALL_SIDES.includes(side)) && sides.some(side => AXIAL_SIDES.includes(side))) {
14095
- // eslint-disable-next-line no-console
14096
- console.warn(`The ${feature} support for the "${blockName}" block can not be configured to support both axial and arbitrary sides.`);
14097
- return false;
 
 
 
14098
  }
14099
 
14100
- return true;
14101
  }
14102
- //# sourceMappingURL=dimensions.js.map
14103
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/style.js
14104
-
14105
 
 
 
 
 
 
 
14106
 
14107
- /**
14108
- * External dependencies
14109
- */
14110
 
 
 
 
 
 
 
 
14111
 
14112
- /**
14113
- * WordPress dependencies
14114
- */
 
 
 
14115
 
 
 
 
 
 
 
 
14116
 
 
 
14117
 
 
 
 
 
 
 
 
 
 
14118
 
14119
- /**
14120
- * Internal dependencies
14121
- */
14122
 
 
 
 
14123
 
 
 
14124
 
 
14125
 
 
 
14126
 
 
 
14127
 
14128
- const styleSupportKeys = [...TYPOGRAPHY_SUPPORT_KEYS, BORDER_SUPPORT_KEY, COLOR_SUPPORT_KEY, SPACING_SUPPORT_KEY];
 
 
 
14129
 
14130
- const hasStyleSupport = blockType => styleSupportKeys.some(key => (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, key));
 
 
 
14131
 
14132
- const VARIABLE_REFERENCE_PREFIX = 'var:';
14133
- const VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';
14134
- const VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';
 
 
 
14135
 
14136
- function compileStyleValue(uncompiledValue) {
14137
- if ((0,external_lodash_namespaceObject.startsWith)(uncompiledValue, VARIABLE_REFERENCE_PREFIX)) {
14138
- const variable = uncompiledValue.slice(VARIABLE_REFERENCE_PREFIX.length).split(VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE).join(VARIABLE_PATH_SEPARATOR_TOKEN_STYLE);
14139
- return `var(--wp--${variable})`;
 
 
 
14140
  }
14141
 
14142
- return uncompiledValue;
14143
- }
14144
- /**
14145
- * Returns the inline styles to add depending on the style object
14146
- *
14147
- * @param {Object} styles Styles configuration.
14148
- *
14149
- * @return {Object} Flattened CSS variables declaration.
14150
- */
14151
-
14152
-
14153
- function getInlineStyles(styles = {}) {
14154
- const output = {};
14155
- Object.keys(external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY).forEach(propKey => {
14156
- const path = external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[propKey].value;
14157
- const subPaths = external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[propKey].properties; // Ignore styles on elements because they are handled on the server.
14158
-
14159
- if ((0,external_lodash_namespaceObject.has)(styles, path) && 'elements' !== (0,external_lodash_namespaceObject.first)(path)) {
14160
- // Checking if style value is a string allows for shorthand css
14161
- // option and backwards compatibility for border radius support.
14162
- const styleValue = (0,external_lodash_namespaceObject.get)(styles, path);
14163
 
14164
- if (!!subPaths && !(0,external_lodash_namespaceObject.isString)(styleValue)) {
14165
- Object.entries(subPaths).forEach(entry => {
14166
- const [name, subPath] = entry;
14167
- const value = (0,external_lodash_namespaceObject.get)(styleValue, [subPath]);
14168
 
14169
- if (value) {
14170
- output[name] = compileStyleValue(value);
14171
- }
14172
- });
14173
- } else {
14174
- output[propKey] = compileStyleValue((0,external_lodash_namespaceObject.get)(styles, path));
14175
  }
14176
- }
14177
- });
14178
- return output;
14179
- }
14180
-
14181
- function compileElementsStyles(selector, elements = {}) {
14182
- return (0,external_lodash_namespaceObject.map)(elements, (styles, element) => {
14183
- const elementStyles = getInlineStyles(styles);
14184
 
14185
- if (!(0,external_lodash_namespaceObject.isEmpty)(elementStyles)) {
14186
- return [`.${selector} ${external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[element]}{`, ...(0,external_lodash_namespaceObject.map)(elementStyles, (value, property) => `\t${(0,external_lodash_namespaceObject.kebabCase)(property)}: ${value};`), '}'].join('\n');
14187
- }
14188
 
14189
- return '';
14190
- }).join('\n');
14191
- }
14192
- /**
14193
- * Filters registered block settings, extending attributes to include `style` attribute.
14194
- *
14195
- * @param {Object} settings Original block settings.
14196
- *
14197
- * @return {Object} Filtered block settings.
14198
- */
14199
 
 
14200
 
14201
- function style_addAttribute(settings) {
14202
- if (!hasStyleSupport(settings)) {
14203
- return settings;
14204
- } // allow blocks to specify their own attribute definition with default values if needed.
14205
 
 
 
 
 
 
 
14206
 
14207
- if (!settings.attributes.style) {
14208
- Object.assign(settings.attributes, {
14209
- style: {
14210
- type: 'object'
14211
  }
14212
- });
 
 
 
 
14213
  }
14214
 
14215
- return settings;
14216
  }
14217
- /**
14218
- * A dictionary of paths to flag skipping block support serialization as the key,
14219
- * with values providing the style paths to be omitted from serialization.
14220
- *
14221
- * @constant
14222
- * @type {Record<string, string[]>}
14223
- */
14224
-
14225
-
14226
- const skipSerializationPathsEdit = {
14227
- [`${BORDER_SUPPORT_KEY}.__experimentalSkipSerialization`]: ['border'],
14228
- [`${COLOR_SUPPORT_KEY}.__experimentalSkipSerialization`]: [COLOR_SUPPORT_KEY],
14229
- [`${TYPOGRAPHY_SUPPORT_KEY}.__experimentalSkipSerialization`]: [TYPOGRAPHY_SUPPORT_KEY],
14230
- [`${SPACING_SUPPORT_KEY}.__experimentalSkipSerialization`]: ['spacing']
14231
- };
14232
- /**
14233
- * A dictionary of paths to flag skipping block support serialization as the key,
14234
- * with values providing the style paths to be omitted from serialization.
14235
- *
14236
- * Extends the Edit skip paths to enable skipping additional paths in just
14237
- * the Save component. This allows a block support to be serialized within the
14238
- * editor, while using an alternate approach, such as server-side rendering, when
14239
- * the support is saved.
14240
- *
14241
- * @constant
14242
- * @type {Record<string, string[]>}
14243
- */
14244
-
14245
- const skipSerializationPathsSave = { ...skipSerializationPathsEdit,
14246
- [`${SPACING_SUPPORT_KEY}`]: ['spacing.blockGap']
14247
- };
14248
- /**
14249
- * Override props assigned to save component to inject the CSS variables definition.
14250
- *
14251
- * @param {Object} props Additional props applied to save element.
14252
- * @param {Object} blockType Block type.
14253
- * @param {Object} attributes Block attributes.
14254
- * @param {?Record<string, string[]>} skipPaths An object of keys and paths to skip serialization.
14255
- *
14256
- * @return {Object} Filtered props applied to save element.
14257
- */
14258
 
14259
- function style_addSaveProps(props, blockType, attributes, skipPaths = skipSerializationPathsSave) {
14260
- if (!hasStyleSupport(blockType)) {
14261
- return props;
14262
- }
14263
 
14264
- let {
14265
- style
14266
- } = attributes;
14267
- (0,external_lodash_namespaceObject.forEach)(skipPaths, (path, indicator) => {
14268
- if ((0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, indicator)) {
14269
- style = (0,external_lodash_namespaceObject.omit)(style, path);
14270
- }
14271
- });
14272
- props.style = { ...getInlineStyles(style),
14273
- ...props.style
14274
- };
14275
- return props;
14276
  }
14277
- /**
14278
- * Filters registered block settings to extend the block edit wrapper
14279
- * to apply the desired styles and classnames properly.
14280
- *
14281
- * @param {Object} settings Original block settings.
14282
- *
14283
- * @return {Object}.Filtered block settings.
14284
- */
14285
 
14286
- function style_addEditProps(settings) {
14287
- if (!hasStyleSupport(settings)) {
14288
- return settings;
 
 
 
 
 
 
 
14289
  }
 
14290
 
14291
- const existingGetEditWrapperProps = settings.getEditWrapperProps;
 
14292
 
14293
- settings.getEditWrapperProps = attributes => {
14294
- let props = {};
 
 
 
14295
 
14296
- if (existingGetEditWrapperProps) {
14297
- props = existingGetEditWrapperProps(attributes);
14298
- }
14299
 
14300
- return style_addSaveProps(props, settings, attributes, skipSerializationPathsEdit);
14301
- };
14302
 
14303
- return settings;
14304
- }
14305
- /**
14306
- * Override the default edit UI to include new inspector controls for
14307
- * all the custom styles configs.
14308
- *
14309
- * @param {Function} BlockEdit Original component.
14310
- *
14311
- * @return {Function} Wrapped component.
14312
- */
14313
 
14314
- const withBlockControls = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => {
14315
- const shouldDisplayControls = useDisplayBlockControls();
14316
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, shouldDisplayControls && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(TypographyPanel, props), (0,external_wp_element_namespaceObject.createElement)(BorderPanel, props), (0,external_wp_element_namespaceObject.createElement)(ColorEdit, props), (0,external_wp_element_namespaceObject.createElement)(DimensionsPanel, props)), (0,external_wp_element_namespaceObject.createElement)(BlockEdit, props));
14317
- }, 'withToolbarControls');
14318
- /**
14319
- * Override the default block element to include duotone styles.
14320
- *
14321
- * @param {Function} BlockListBlock Original component
14322
- * @return {Function} Wrapped component
14323
- */
14324
 
14325
- const withElementsStyles = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockListBlock => props => {
14326
- var _props$attributes$sty, _props$attributes$sty2;
14327
 
14328
- const elements = (_props$attributes$sty = props.attributes.style) === null || _props$attributes$sty === void 0 ? void 0 : _props$attributes$sty.elements;
14329
- const blockElementsContainerIdentifier = `wp-elements-${(0,external_wp_compose_namespaceObject.useInstanceId)(BlockListBlock)}`;
14330
- const styles = compileElementsStyles(blockElementsContainerIdentifier, (_props$attributes$sty2 = props.attributes.style) === null || _props$attributes$sty2 === void 0 ? void 0 : _props$attributes$sty2.elements);
14331
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, elements && (0,external_wp_element_namespaceObject.createElement)("style", {
14332
- dangerouslySetInnerHTML: {
14333
- __html: styles
14334
- }
14335
- }), (0,external_wp_element_namespaceObject.createElement)(BlockListBlock, _extends({}, props, {
14336
- className: elements ? classnames_default()(props.className, blockElementsContainerIdentifier) : props.className
14337
- })));
14338
- });
14339
- (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/style/addAttribute', style_addAttribute);
14340
- (0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/style/addSaveProps', style_addSaveProps);
14341
- (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/style/addEditProps', style_addEditProps);
14342
- (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/style/with-block-controls', withBlockControls);
14343
- (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockListBlock', 'core/editor/with-elements-styles', withElementsStyles);
14344
- //# sourceMappingURL=style.js.map
14345
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/duotone-control/index.js
14346
 
14347
 
14348
- /**
14349
- * WordPress dependencies
14350
- */
14351
 
 
 
 
 
 
14352
 
 
 
 
 
 
14353
 
 
 
14354
 
14355
- function DuotoneControl({
14356
- colorPalette,
14357
- duotonePalette,
14358
- disableCustomColors,
14359
- disableCustomDuotone,
14360
- value,
14361
- onChange
14362
- }) {
14363
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
14364
- popoverProps: {
14365
- className: 'block-editor-duotone-control__popover',
14366
- headerTitle: (0,external_wp_i18n_namespaceObject.__)('Duotone')
14367
- },
14368
- renderToggle: ({
14369
- isOpen,
14370
- onToggle
14371
- }) => {
14372
- const openOnArrowDown = event => {
14373
- if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) {
14374
- event.preventDefault();
14375
- onToggle();
14376
- }
14377
- };
14378
 
14379
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
14380
- showTooltip: true,
14381
- onClick: onToggle,
14382
- "aria-haspopup": "true",
14383
- "aria-expanded": isOpen,
14384
- onKeyDown: openOnArrowDown,
14385
- label: (0,external_wp_i18n_namespaceObject.__)('Apply duotone filter'),
14386
- icon: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DuotoneSwatch, {
14387
- values: value
14388
- })
14389
- });
14390
- },
14391
- renderContent: () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
14392
- label: (0,external_wp_i18n_namespaceObject.__)('Duotone')
14393
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DuotonePicker, {
14394
- colorPalette: colorPalette,
14395
- duotonePalette: duotonePalette,
14396
- disableCustomColors: disableCustomColors,
14397
- disableCustomDuotone: disableCustomDuotone,
14398
- value: value,
14399
- onChange: onChange
14400
- }))
14401
- });
14402
  }
14403
 
14404
- /* harmony default export */ var duotone_control = (DuotoneControl);
14405
- //# sourceMappingURL=index.js.map
14406
- ;// CONCATENATED MODULE: external ["wp","dom"]
14407
- var external_wp_dom_namespaceObject = window["wp"]["dom"];
14408
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-context/index.js
14409
 
 
14410
 
14411
- /**
14412
- * WordPress dependencies
14413
- */
 
 
 
 
 
14414
 
14415
- /** @typedef {import('react').ReactNode} ReactNode */
 
14416
 
14417
- /**
14418
- * @typedef BlockContextProviderProps
14419
- *
14420
- * @property {Record<string,*>} value Context value to merge with current
14421
- * value.
14422
- * @property {ReactNode} children Component children.
14423
- */
14424
 
14425
- /** @type {import('react').Context<Record<string,*>>} */
 
 
14426
 
14427
- const block_context_Context = (0,external_wp_element_namespaceObject.createContext)({});
14428
- /**
14429
- * Component which merges passed value with current consumed block context.
14430
- *
14431
- * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-context/README.md
14432
- *
14433
- * @param {BlockContextProviderProps} props
14434
- */
14435
 
14436
- function BlockContextProvider({
14437
- value,
14438
- children
14439
- }) {
14440
- const context = (0,external_wp_element_namespaceObject.useContext)(block_context_Context);
14441
- const nextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...context,
14442
- ...value
14443
- }), [context, value]);
14444
- return (0,external_wp_element_namespaceObject.createElement)(block_context_Context.Provider, {
14445
- value: nextValue,
14446
- children: children
14447
  });
14448
- }
14449
- /* harmony default export */ var block_context = (block_context_Context);
14450
- //# sourceMappingURL=index.js.map
14451
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-edit/edit.js
14452
-
14453
 
 
 
 
14454
 
14455
- /**
14456
- * External dependencies
14457
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14458
 
 
14459
 
14460
- /**
14461
- * WordPress dependencies
14462
- */
 
 
14463
 
 
 
 
 
14464
 
 
14465
 
 
14466
 
14467
- /**
14468
- * Internal dependencies
14469
- */
 
 
 
 
 
14470
 
 
 
14471
 
14472
- /**
14473
- * Default value used for blocks which do not define their own context needs,
14474
- * used to guarantee that a block's `context` prop will always be an object. It
14475
- * is assigned as a constant since it is always expected to be an empty object,
14476
- * and in order to avoid unnecessary React reconciliations of a changing object.
14477
- *
14478
- * @type {{}}
14479
- */
14480
 
14481
- const DEFAULT_BLOCK_CONTEXT = {};
14482
- const Edit = props => {
14483
- const {
14484
- attributes = {},
14485
- name
14486
- } = props;
14487
- const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
14488
- const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context); // Assign context values using the block type's declared context needs.
 
 
 
 
14489
 
14490
- const context = (0,external_wp_element_namespaceObject.useMemo)(() => {
14491
- return blockType && blockType.usesContext ? (0,external_lodash_namespaceObject.pick)(blockContext, blockType.usesContext) : DEFAULT_BLOCK_CONTEXT;
14492
- }, [blockType, blockContext]);
14493
 
14494
- if (!blockType) {
14495
- return null;
14496
- } // `edit` and `save` are functions or components describing the markup
14497
- // with which a block is displayed. If `blockType` is valid, assign
14498
- // them preferentially as the render value for the block.
14499
 
 
14500
 
14501
- const Component = blockType.edit || blockType.save;
 
 
 
 
 
 
14502
 
14503
- if (blockType.apiVersion > 1) {
14504
- return (0,external_wp_element_namespaceObject.createElement)(Component, _extends({}, props, {
14505
- context: context
14506
- }));
14507
- } // Generate a class name for the block's editable form
14508
 
 
 
 
 
 
 
 
 
 
 
 
14509
 
14510
- const generatedClassName = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'className', true) ? (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(name) : null;
14511
- const className = classnames_default()(generatedClassName, attributes.className);
14512
- return (0,external_wp_element_namespaceObject.createElement)(Component, _extends({}, props, {
14513
- context: context,
14514
- className: className
14515
- }));
14516
- };
14517
- /* harmony default export */ var edit = ((0,external_wp_components_namespaceObject.withFilters)('editor.BlockEdit')(Edit));
14518
- //# sourceMappingURL=edit.js.map
14519
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-edit/index.js
14520
 
 
 
 
14521
 
14522
- /**
14523
- * WordPress dependencies
14524
- */
 
14525
 
14526
- /**
14527
- * Internal dependencies
14528
- */
14529
 
 
14530
 
 
14531
 
 
 
 
 
 
 
 
 
 
 
 
14532
 
14533
- function BlockEdit(props) {
14534
- const {
14535
- name,
14536
- isSelected,
14537
- clientId
14538
- } = props;
14539
- const context = {
14540
- name,
14541
- isSelected,
14542
- clientId
14543
- };
14544
- return (0,external_wp_element_namespaceObject.createElement)(Provider // It is important to return the same object if props haven't
14545
- // changed to avoid unnecessary rerenders.
14546
- // See https://reactjs.org/docs/context.html#caveats.
14547
- , {
14548
- value: (0,external_wp_element_namespaceObject.useMemo)(() => context, Object.values(context))
14549
- }, (0,external_wp_element_namespaceObject.createElement)(edit, props));
14550
- }
14551
- //# sourceMappingURL=index.js.map
14552
- ;// CONCATENATED MODULE: ./packages/icons/build-module/library/more-horizontal.js
14553
 
14554
 
 
 
 
 
 
 
14555
  /**
14556
  * WordPress dependencies
14557
  */
14558
 
14559
- const moreHorizontal = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
14560
- xmlns: "http://www.w3.org/2000/svg",
14561
- viewBox: "0 0 24 24"
14562
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
14563
- d: "M11 13h2v-2h-2v2zm-6 0h2v-2H5v2zm12-2v2h2v-2h-2z"
14564
- }));
14565
- /* harmony default export */ var more_horizontal = (moreHorizontal);
14566
- //# sourceMappingURL=more-horizontal.js.map
14567
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/warning/index.js
14568
 
14569
 
14570
  /**
14571
- * External dependencies
 
 
 
14572
  */
14573
 
 
 
 
 
 
 
 
 
14574
  /**
14575
- * WordPress dependencies
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14576
  */
14577
 
14578
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14579
 
 
 
 
14580
 
 
 
 
 
14581
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14582
 
14583
- function Warning({
14584
- className,
14585
- actions,
14586
- children,
14587
- secondaryActions
14588
- }) {
14589
- return (0,external_wp_element_namespaceObject.createElement)("div", {
14590
- className: classnames_default()(className, 'block-editor-warning')
14591
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
14592
- className: "block-editor-warning__contents"
14593
- }, (0,external_wp_element_namespaceObject.createElement)("p", {
14594
- className: "block-editor-warning__message"
14595
- }, children), (external_wp_element_namespaceObject.Children.count(actions) > 0 || secondaryActions) && (0,external_wp_element_namespaceObject.createElement)("div", {
14596
- className: "block-editor-warning__actions"
14597
- }, external_wp_element_namespaceObject.Children.count(actions) > 0 && external_wp_element_namespaceObject.Children.map(actions, (action, i) => (0,external_wp_element_namespaceObject.createElement)("span", {
14598
- key: i,
14599
- className: "block-editor-warning__action"
14600
- }, action)), secondaryActions && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
14601
- className: "block-editor-warning__secondary",
14602
- icon: more_horizontal,
14603
- label: (0,external_wp_i18n_namespaceObject.__)('More options'),
14604
- popoverProps: {
14605
- position: 'bottom left',
14606
- className: 'block-editor-warning__dropdown'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14607
  },
14608
- noIcons: true
14609
- }, () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, secondaryActions.map((item, pos) => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
14610
- onClick: item.onClick,
14611
- key: pos
14612
- }, item.title)))))));
 
 
 
 
 
 
 
 
 
14613
  }
14614
- /**
14615
- * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/warning/README.md
14616
- */
14617
-
14618
 
14619
- /* harmony default export */ var warning = (Warning);
14620
  //# sourceMappingURL=index.js.map
14621
- // EXTERNAL MODULE: ./node_modules/diff/lib/diff/character.js
14622
- var character = __webpack_require__(7630);
14623
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-compare/block-view.js
 
 
 
 
 
 
 
 
14624
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14625
 
 
 
 
 
14626
  /**
14627
- * WordPress dependencies
 
 
 
 
 
14628
  */
14629
 
 
 
 
 
14630
 
 
 
 
14631
 
14632
- function BlockView({
14633
- title,
14634
- rawContent,
14635
- renderedContent,
14636
- action,
14637
- actionText,
14638
- className
14639
- }) {
14640
- return (0,external_wp_element_namespaceObject.createElement)("div", {
14641
- className: className
14642
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
14643
- className: "block-editor-block-compare__content"
14644
- }, (0,external_wp_element_namespaceObject.createElement)("h2", {
14645
- className: "block-editor-block-compare__heading"
14646
- }, title), (0,external_wp_element_namespaceObject.createElement)("div", {
14647
- className: "block-editor-block-compare__html"
14648
- }, rawContent), (0,external_wp_element_namespaceObject.createElement)("div", {
14649
- className: "block-editor-block-compare__preview edit-post-visual-editor"
14650
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, (0,external_wp_dom_namespaceObject.safeHTML)(renderedContent)))), (0,external_wp_element_namespaceObject.createElement)("div", {
14651
- className: "block-editor-block-compare__action"
14652
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
14653
- variant: "secondary",
14654
- tabIndex: "0",
14655
- onClick: action
14656
- }, actionText)));
14657
- }
14658
- //# sourceMappingURL=block-view.js.map
14659
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-compare/index.js
14660
 
 
 
 
14661
 
 
 
 
 
14662
  /**
14663
  * External dependencies
14664
  */
14665
 
14666
- // diff doesn't tree-shake correctly, so we import from the individual
14667
- // module here, to avoid including too much of the library
14668
-
14669
-
14670
  /**
14671
  * WordPress dependencies
14672
  */
14673
 
14674
 
14675
 
 
14676
  /**
14677
  * Internal dependencies
14678
  */
14679
 
14680
 
14681
 
14682
- function BlockCompare({
14683
- block,
14684
- onKeep,
14685
- onConvert,
14686
- convertor,
14687
- convertButtonText
14688
- }) {
14689
- function getDifference(originalContent, newContent) {
14690
- const difference = (0,character/* diffChars */.Kx)(originalContent, newContent);
14691
- return difference.map((item, pos) => {
14692
- const classes = classnames_default()({
14693
- 'block-editor-block-compare__added': item.added,
14694
- 'block-editor-block-compare__removed': item.removed
14695
- });
14696
- return (0,external_wp_element_namespaceObject.createElement)("span", {
14697
- key: pos,
14698
- className: classes
14699
- }, item.value);
14700
- });
14701
- }
14702
 
14703
- function getConvertedContent(convertedBlock) {
14704
- // The convertor may return an array of items or a single item
14705
- const newBlocks = (0,external_lodash_namespaceObject.castArray)(convertedBlock); // Get converted block details
 
 
 
 
 
14706
 
14707
- const newContent = newBlocks.map(item => (0,external_wp_blocks_namespaceObject.getSaveContent)(item.name, item.attributes, item.innerBlocks));
14708
- return newContent.join('');
14709
- }
 
 
 
 
 
14710
 
14711
- const converted = getConvertedContent(convertor(block));
14712
- const difference = getDifference(block.originalContent, converted);
14713
- return (0,external_wp_element_namespaceObject.createElement)("div", {
14714
- className: "block-editor-block-compare__wrapper"
14715
- }, (0,external_wp_element_namespaceObject.createElement)(BlockView, {
14716
- title: (0,external_wp_i18n_namespaceObject.__)('Current'),
14717
- className: "block-editor-block-compare__current",
14718
- action: onKeep,
14719
- actionText: (0,external_wp_i18n_namespaceObject.__)('Convert to HTML'),
14720
- rawContent: block.originalContent,
14721
- renderedContent: block.originalContent
14722
- }), (0,external_wp_element_namespaceObject.createElement)(BlockView, {
14723
- title: (0,external_wp_i18n_namespaceObject.__)('After Conversion'),
14724
- className: "block-editor-block-compare__converted",
14725
- action: onConvert,
14726
- actionText: convertButtonText,
14727
- rawContent: difference,
14728
- renderedContent: converted
14729
- }));
14730
- }
14731
 
14732
- /* harmony default export */ var block_compare = (BlockCompare);
14733
- //# sourceMappingURL=index.js.map
14734
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/block-invalid-warning.js
14735
 
14736
 
 
 
 
14737
  /**
14738
- * WordPress dependencies
 
 
 
 
 
14739
  */
14740
 
14741
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14742
 
 
 
 
 
14743
 
 
 
 
 
 
 
 
 
 
14744
 
14745
 
14746
  /**
@@ -14749,1516 +14956,1020 @@ function BlockCompare({
14749
 
14750
 
14751
 
 
 
 
 
14752
 
14753
- function BlockInvalidWarning({
14754
- convertToHTML,
14755
- convertToBlocks,
14756
- convertToClassic,
14757
- attemptBlockRecovery,
14758
- block
14759
- }) {
14760
- const hasHTMLBlock = !!(0,external_wp_blocks_namespaceObject.getBlockType)('core/html');
14761
- const [compare, setCompare] = (0,external_wp_element_namespaceObject.useState)(false);
14762
- const onCompare = (0,external_wp_element_namespaceObject.useCallback)(() => setCompare(true), []);
14763
- const onCompareClose = (0,external_wp_element_namespaceObject.useCallback)(() => setCompare(false), []); // We memo the array here to prevent the children components from being updated unexpectedly
14764
 
14765
- const hiddenActions = (0,external_wp_element_namespaceObject.useMemo)(() => [{
14766
- // translators: Button to fix block content
14767
- title: (0,external_wp_i18n_namespaceObject._x)('Resolve', 'imperative verb'),
14768
- onClick: onCompare
14769
- }, hasHTMLBlock && {
14770
- title: (0,external_wp_i18n_namespaceObject.__)('Convert to HTML'),
14771
- onClick: convertToHTML
14772
- }, {
14773
- title: (0,external_wp_i18n_namespaceObject.__)('Convert to Classic Block'),
14774
- onClick: convertToClassic
14775
- }].filter(Boolean), [onCompare, convertToHTML, convertToClassic]);
14776
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(warning, {
14777
- actions: [(0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
14778
- key: "recover",
14779
- onClick: attemptBlockRecovery,
14780
- variant: "primary"
14781
- }, (0,external_wp_i18n_namespaceObject.__)('Attempt Block Recovery'))],
14782
- secondaryActions: hiddenActions
14783
- }, (0,external_wp_i18n_namespaceObject.__)('This block contains unexpected or invalid content.')), compare && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
14784
- title: // translators: Dialog title to fix block content
14785
- (0,external_wp_i18n_namespaceObject.__)('Resolve Block'),
14786
- onRequestClose: onCompareClose,
14787
- className: "block-editor-block-compare"
14788
- }, (0,external_wp_element_namespaceObject.createElement)(block_compare, {
14789
- block: block,
14790
- onKeep: convertToHTML,
14791
- onConvert: convertToBlocks,
14792
- convertor: blockToBlocks,
14793
- convertButtonText: (0,external_wp_i18n_namespaceObject.__)('Convert to Blocks')
14794
- })));
14795
- }
14796
 
14797
- const blockToClassic = block => (0,external_wp_blocks_namespaceObject.createBlock)('core/freeform', {
14798
- content: block.originalContent
14799
- });
14800
-
14801
- const blockToHTML = block => (0,external_wp_blocks_namespaceObject.createBlock)('core/html', {
14802
- content: block.originalContent
14803
- });
14804
-
14805
- const blockToBlocks = block => (0,external_wp_blocks_namespaceObject.rawHandler)({
14806
- HTML: block.originalContent
14807
- });
14808
-
14809
- const recoverBlock = ({
14810
- name,
14811
- attributes,
14812
- innerBlocks
14813
- }) => (0,external_wp_blocks_namespaceObject.createBlock)(name, attributes, innerBlocks);
14814
-
14815
- /* harmony default export */ var block_invalid_warning = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, {
14816
- clientId
14817
- }) => ({
14818
- block: select(store).getBlock(clientId)
14819
- })), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, {
14820
- block
14821
- }) => {
14822
- const {
14823
- replaceBlock
14824
- } = dispatch(store);
14825
- return {
14826
- convertToClassic() {
14827
- replaceBlock(block.clientId, blockToClassic(block));
14828
- },
14829
-
14830
- convertToHTML() {
14831
- replaceBlock(block.clientId, blockToHTML(block));
14832
- },
14833
-
14834
- convertToBlocks() {
14835
- replaceBlock(block.clientId, blockToBlocks(block));
14836
- },
14837
 
14838
- attemptBlockRecovery() {
14839
- replaceBlock(block.clientId, recoverBlock(block));
14840
  }
14841
-
14842
- };
14843
- })])(BlockInvalidWarning));
14844
- //# sourceMappingURL=block-invalid-warning.js.map
14845
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/block-crash-warning.js
14846
-
 
14847
 
14848
  /**
14849
  * WordPress dependencies
14850
  */
14851
 
 
 
14852
  /**
14853
  * Internal dependencies
14854
  */
14855
 
14856
 
14857
- const block_crash_warning_warning = (0,external_wp_element_namespaceObject.createElement)(warning, {
14858
- className: "block-editor-block-list__block-crash-warning"
14859
- }, (0,external_wp_i18n_namespaceObject.__)('This block has encountered an error and cannot be previewed.'));
14860
- /* harmony default export */ var block_crash_warning = (() => block_crash_warning_warning);
14861
- //# sourceMappingURL=block-crash-warning.js.map
14862
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/block-crash-boundary.js
14863
  /**
14864
- * WordPress dependencies
 
 
 
 
14865
  */
14866
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14867
 
14868
- class BlockCrashBoundary extends external_wp_element_namespaceObject.Component {
14869
- constructor() {
14870
- super(...arguments);
14871
- this.state = {
14872
- hasError: false
14873
- };
14874
- }
14875
-
14876
- componentDidCatch() {
14877
- this.setState({
14878
- hasError: true
 
 
14879
  });
14880
- }
14881
-
14882
- render() {
14883
- if (this.state.hasError) {
14884
- return this.props.fallback;
14885
- }
14886
-
14887
- return this.props.children;
14888
- }
14889
-
14890
  }
14891
-
14892
- /* harmony default export */ var block_crash_boundary = (BlockCrashBoundary);
14893
- //# sourceMappingURL=block-crash-boundary.js.map
14894
- // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js
14895
- var lib = __webpack_require__(4042);
14896
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/block-html.js
14897
-
14898
-
14899
- /**
14900
- * External dependencies
14901
- */
14902
-
14903
  /**
14904
  * WordPress dependencies
14905
  */
14906
 
14907
 
14908
-
14909
-
14910
  /**
14911
  * Internal dependencies
14912
  */
14913
 
14914
 
 
 
 
 
 
 
 
 
14915
 
14916
- function BlockHTML({
14917
- clientId
14918
- }) {
14919
- const [html, setHtml] = (0,external_wp_element_namespaceObject.useState)('');
14920
- const block = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getBlock(clientId), [clientId]);
14921
- const {
14922
- updateBlock
14923
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
14924
-
14925
- const onChange = () => {
14926
- const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name);
14927
- const attributes = (0,external_wp_blocks_namespaceObject.getBlockAttributes)(blockType, html, block.attributes); // If html is empty we reset the block to the default HTML and mark it as valid to avoid triggering an error
14928
-
14929
- const content = html ? html : (0,external_wp_blocks_namespaceObject.getSaveContent)(blockType, attributes);
14930
- const isValid = html ? (0,external_wp_blocks_namespaceObject.isValidBlockContent)(blockType, attributes, content) : true;
14931
- updateBlock(clientId, {
14932
- attributes,
14933
- originalContent: content,
14934
- isValid
14935
- }); // Ensure the state is updated if we reset so it displays the default content
14936
 
14937
- if (!html) {
14938
- setHtml({
14939
- content
14940
- });
14941
  }
14942
- };
14943
 
14944
- (0,external_wp_element_namespaceObject.useEffect)(() => {
14945
- setHtml((0,external_wp_blocks_namespaceObject.getBlockContent)(block));
14946
- }, [block]);
14947
- return (0,external_wp_element_namespaceObject.createElement)(lib/* default */.Z, {
14948
- className: "block-editor-block-list__block-html-textarea",
14949
- value: html,
14950
- onBlur: onChange,
14951
- onChange: event => setHtml(event.target.value)
14952
- });
14953
  }
 
 
 
 
 
14954
 
14955
- /* harmony default export */ var block_html = (BlockHTML);
14956
- //# sourceMappingURL=block-html.js.map
14957
- ;// CONCATENATED MODULE: ./node_modules/@react-spring/rafz/dist/react-spring-rafz.esm.js
14958
- let updateQueue = makeQueue();
14959
- const raf = fn => schedule(fn, updateQueue);
14960
- let writeQueue = makeQueue();
14961
-
14962
- raf.write = fn => schedule(fn, writeQueue);
14963
-
14964
- let onStartQueue = makeQueue();
14965
-
14966
- raf.onStart = fn => schedule(fn, onStartQueue);
14967
-
14968
- let onFrameQueue = makeQueue();
14969
-
14970
- raf.onFrame = fn => schedule(fn, onFrameQueue);
14971
-
14972
- let onFinishQueue = makeQueue();
14973
-
14974
- raf.onFinish = fn => schedule(fn, onFinishQueue);
14975
-
14976
- let timeouts = [];
14977
-
14978
- raf.setTimeout = (handler, ms) => {
14979
- let time = raf.now() + ms;
14980
-
14981
- let cancel = () => {
14982
- let i = timeouts.findIndex(t => t.cancel == cancel);
14983
- if (~i) timeouts.splice(i, 1);
14984
- __raf.count -= ~i ? 1 : 0;
14985
- };
14986
-
14987
- let timeout = {
14988
- time,
14989
- handler,
14990
- cancel
14991
- };
14992
- timeouts.splice(findTimeout(time), 0, timeout);
14993
- __raf.count += 1;
14994
- start();
14995
- return timeout;
14996
- };
14997
 
14998
- let findTimeout = time => ~(~timeouts.findIndex(t => t.time > time) || ~timeouts.length);
 
 
14999
 
15000
- raf.cancel = fn => {
15001
- updateQueue.delete(fn);
15002
- writeQueue.delete(fn);
15003
- };
15004
 
15005
- raf.sync = fn => {
15006
- sync = true;
15007
- raf.batchedUpdates(fn);
15008
- sync = false;
15009
- };
 
 
15010
 
15011
- raf.throttle = fn => {
15012
- let lastArgs;
 
 
 
 
 
 
 
 
15013
 
15014
- function queuedFn() {
15015
- try {
15016
- fn(...lastArgs);
15017
- } finally {
15018
- lastArgs = null;
15019
  }
15020
- }
15021
-
15022
- function throttled(...args) {
15023
- lastArgs = args;
15024
- raf.onStart(queuedFn);
15025
- }
15026
-
15027
- throttled.handler = fn;
15028
-
15029
- throttled.cancel = () => {
15030
- onStartQueue.delete(queuedFn);
15031
- lastArgs = null;
15032
- };
15033
-
15034
- return throttled;
15035
- };
15036
-
15037
- let nativeRaf = typeof window != 'undefined' ? window.requestAnimationFrame : () => {};
15038
 
15039
- raf.use = impl => nativeRaf = impl;
15040
-
15041
- raf.now = typeof performance != 'undefined' ? () => performance.now() : Date.now;
15042
-
15043
- raf.batchedUpdates = fn => fn();
15044
-
15045
- raf.catch = console.error;
15046
- raf.frameLoop = 'always';
15047
-
15048
- raf.advance = () => {
15049
- if (raf.frameLoop !== 'demand') {
15050
- console.warn('Cannot call the manual advancement of rafz whilst frameLoop is not set as demand');
15051
- } else {
15052
- update();
15053
- }
15054
- };
15055
-
15056
- let ts = -1;
15057
- let sync = false;
15058
-
15059
- function schedule(fn, queue) {
15060
- if (sync) {
15061
- queue.delete(fn);
15062
- fn(0);
15063
- } else {
15064
- queue.add(fn);
15065
- start();
15066
- }
15067
- }
15068
-
15069
- function start() {
15070
- if (ts < 0) {
15071
- ts = 0;
15072
 
15073
- if (raf.frameLoop !== 'demand') {
15074
- nativeRaf(loop);
15075
  }
15076
- }
15077
- }
15078
 
15079
- function loop() {
15080
- if (~ts) {
15081
- nativeRaf(loop);
15082
- raf.batchedUpdates(update);
15083
- }
15084
  }
 
 
 
 
 
15085
 
15086
- function update() {
15087
- let prevTs = ts;
15088
- ts = raf.now();
15089
- let count = findTimeout(ts);
15090
-
15091
- if (count) {
15092
- eachSafely(timeouts.splice(0, count), t => t.handler());
15093
- __raf.count -= count;
15094
- }
15095
 
15096
- onStartQueue.flush();
15097
- updateQueue.flush(prevTs ? Math.min(64, ts - prevTs) : 16.667);
15098
- onFrameQueue.flush();
15099
- writeQueue.flush();
15100
- onFinishQueue.flush();
15101
- }
15102
 
15103
- function makeQueue() {
15104
- let next = new Set();
15105
- let current = next;
15106
- return {
15107
- add(fn) {
15108
- __raf.count += current == next && !next.has(fn) ? 1 : 0;
15109
- next.add(fn);
15110
- },
15111
 
15112
- delete(fn) {
15113
- __raf.count -= current == next && next.has(fn) ? 1 : 0;
15114
- return next.delete(fn);
15115
- },
15116
 
15117
- flush(arg) {
15118
- if (current.size) {
15119
- next = new Set();
15120
- __raf.count -= current.size;
15121
- eachSafely(current, fn => fn(arg) && next.add(fn));
15122
- __raf.count += next.size;
15123
- current = next;
15124
- }
15125
- }
15126
 
15127
- };
15128
- }
 
 
 
 
 
 
 
 
15129
 
15130
- function eachSafely(values, each) {
15131
- values.forEach(value => {
15132
- try {
15133
- each(value);
15134
- } catch (e) {
15135
- raf.catch(e);
15136
  }
15137
- });
15138
- }
15139
-
15140
- const __raf = {
15141
- count: 0,
15142
-
15143
- clear() {
15144
- ts = -1;
15145
- timeouts = [];
15146
- onStartQueue = makeQueue();
15147
- updateQueue = makeQueue();
15148
- onFrameQueue = makeQueue();
15149
- writeQueue = makeQueue();
15150
- onFinishQueue = makeQueue();
15151
- __raf.count = 0;
15152
- }
15153
-
15154
- };
15155
-
15156
-
15157
-
15158
- // EXTERNAL MODULE: external "React"
15159
- var external_React_ = __webpack_require__(3804);
15160
- var external_React_default = /*#__PURE__*/__webpack_require__.n(external_React_);
15161
- ;// CONCATENATED MODULE: ./node_modules/@react-spring/shared/dist/react-spring-shared.esm.js
15162
-
15163
-
15164
 
 
15165
 
15166
-
15167
- function noop() {}
15168
- const defineHidden = (obj, key, value) => Object.defineProperty(obj, key, {
15169
- value,
15170
- writable: true,
15171
- configurable: true
15172
- });
15173
- const react_spring_shared_esm_is = {
15174
- arr: Array.isArray,
15175
- obj: a => !!a && a.constructor.name === 'Object',
15176
- fun: a => typeof a === 'function',
15177
- str: a => typeof a === 'string',
15178
- num: a => typeof a === 'number',
15179
- und: a => a === undefined
15180
- };
15181
- function isEqual(a, b) {
15182
- if (react_spring_shared_esm_is.arr(a)) {
15183
- if (!react_spring_shared_esm_is.arr(b) || a.length !== b.length) return false;
15184
-
15185
- for (let i = 0; i < a.length; i++) {
15186
- if (a[i] !== b[i]) return false;
15187
  }
15188
 
15189
- return true;
15190
- }
15191
-
15192
- return a === b;
15193
- }
15194
- const react_spring_shared_esm_each = (obj, fn) => obj.forEach(fn);
15195
- function eachProp(obj, fn, ctx) {
15196
- for (const key in obj) {
15197
- if (obj.hasOwnProperty(key)) {
15198
- fn.call(ctx, obj[key], key);
15199
- }
15200
- }
15201
- }
15202
- const react_spring_shared_esm_toArray = a => react_spring_shared_esm_is.und(a) ? [] : react_spring_shared_esm_is.arr(a) ? a : [a];
15203
- function flush(queue, iterator) {
15204
- if (queue.size) {
15205
- const items = Array.from(queue);
15206
- queue.clear();
15207
- react_spring_shared_esm_each(items, iterator);
15208
- }
15209
  }
15210
- const flushCalls = (queue, ...args) => flush(queue, fn => fn(...args));
15211
-
15212
- let createStringInterpolator$1;
15213
- let to;
15214
- let colors$1 = null;
15215
- let skipAnimation = false;
15216
- let willAdvance = noop;
15217
- const react_spring_shared_esm_assign = globals => {
15218
- if (globals.to) to = globals.to;
15219
- if (globals.now) raf.now = globals.now;
15220
- if (globals.colors !== undefined) colors$1 = globals.colors;
15221
- if (globals.skipAnimation != null) skipAnimation = globals.skipAnimation;
15222
- if (globals.createStringInterpolator) createStringInterpolator$1 = globals.createStringInterpolator;
15223
- if (globals.requestAnimationFrame) raf.use(globals.requestAnimationFrame);
15224
- if (globals.batchedUpdates) raf.batchedUpdates = globals.batchedUpdates;
15225
- if (globals.willAdvance) willAdvance = globals.willAdvance;
15226
- if (globals.frameLoop) raf.frameLoop = globals.frameLoop;
15227
- };
15228
-
15229
- var globals = /*#__PURE__*/Object.freeze({
15230
- __proto__: null,
15231
- get createStringInterpolator () { return createStringInterpolator$1; },
15232
- get to () { return to; },
15233
- get colors () { return colors$1; },
15234
- get skipAnimation () { return skipAnimation; },
15235
- get willAdvance () { return willAdvance; },
15236
- assign: react_spring_shared_esm_assign
15237
- });
15238
-
15239
- const startQueue = new Set();
15240
- let currentFrame = [];
15241
- let prevFrame = [];
15242
- let priority = 0;
15243
- const frameLoop = {
15244
- get idle() {
15245
- return !startQueue.size && !currentFrame.length;
15246
- },
15247
-
15248
- start(animation) {
15249
- if (priority > animation.priority) {
15250
- startQueue.add(animation);
15251
- raf.onStart(flushStartQueue);
15252
- } else {
15253
- startSafely(animation);
15254
- raf(advance);
15255
- }
15256
- },
15257
-
15258
- advance,
15259
-
15260
- sort(animation) {
15261
- if (priority) {
15262
- raf.onFrame(() => frameLoop.sort(animation));
15263
- } else {
15264
- const prevIndex = currentFrame.indexOf(animation);
15265
 
15266
- if (~prevIndex) {
15267
- currentFrame.splice(prevIndex, 1);
15268
- startUnsafely(animation);
15269
- }
15270
- }
15271
- },
15272
 
15273
- clear() {
15274
- currentFrame = [];
15275
- startQueue.clear();
15276
- }
15277
 
15278
- };
15279
 
15280
- function flushStartQueue() {
15281
- startQueue.forEach(startSafely);
15282
- startQueue.clear();
15283
- raf(advance);
15284
- }
15285
 
15286
- function startSafely(animation) {
15287
- if (!currentFrame.includes(animation)) startUnsafely(animation);
15288
- }
15289
-
15290
- function startUnsafely(animation) {
15291
- currentFrame.splice(findIndex(currentFrame, other => other.priority > animation.priority), 0, animation);
15292
- }
15293
 
15294
- function advance(dt) {
15295
- const nextFrame = prevFrame;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15296
 
15297
- for (let i = 0; i < currentFrame.length; i++) {
15298
- const animation = currentFrame[i];
15299
- priority = animation.priority;
15300
 
15301
- if (!animation.idle) {
15302
- willAdvance(animation);
15303
- animation.advance(dt);
15304
 
15305
- if (!animation.idle) {
15306
- nextFrame.push(animation);
15307
  }
15308
- }
15309
- }
15310
-
15311
- priority = 0;
15312
- prevFrame = currentFrame;
15313
- prevFrame.length = 0;
15314
- currentFrame = nextFrame;
15315
- return currentFrame.length > 0;
15316
- }
15317
-
15318
- function findIndex(arr, test) {
15319
- const index = arr.findIndex(test);
15320
- return index < 0 ? arr.length : index;
15321
- }
15322
 
15323
- const colors = {
15324
- transparent: 0x00000000,
15325
- aliceblue: 0xf0f8ffff,
15326
- antiquewhite: 0xfaebd7ff,
15327
- aqua: 0x00ffffff,
15328
- aquamarine: 0x7fffd4ff,
15329
- azure: 0xf0ffffff,
15330
- beige: 0xf5f5dcff,
15331
- bisque: 0xffe4c4ff,
15332
- black: 0x000000ff,
15333
- blanchedalmond: 0xffebcdff,
15334
- blue: 0x0000ffff,
15335
- blueviolet: 0x8a2be2ff,
15336
- brown: 0xa52a2aff,
15337
- burlywood: 0xdeb887ff,
15338
- burntsienna: 0xea7e5dff,
15339
- cadetblue: 0x5f9ea0ff,
15340
- chartreuse: 0x7fff00ff,
15341
- chocolate: 0xd2691eff,
15342
- coral: 0xff7f50ff,
15343
- cornflowerblue: 0x6495edff,
15344
- cornsilk: 0xfff8dcff,
15345
- crimson: 0xdc143cff,
15346
- cyan: 0x00ffffff,
15347
- darkblue: 0x00008bff,
15348
- darkcyan: 0x008b8bff,
15349
- darkgoldenrod: 0xb8860bff,
15350
- darkgray: 0xa9a9a9ff,
15351
- darkgreen: 0x006400ff,
15352
- darkgrey: 0xa9a9a9ff,
15353
- darkkhaki: 0xbdb76bff,
15354
- darkmagenta: 0x8b008bff,
15355
- darkolivegreen: 0x556b2fff,
15356
- darkorange: 0xff8c00ff,
15357
- darkorchid: 0x9932ccff,
15358
- darkred: 0x8b0000ff,
15359
- darksalmon: 0xe9967aff,
15360
- darkseagreen: 0x8fbc8fff,
15361
- darkslateblue: 0x483d8bff,
15362
- darkslategray: 0x2f4f4fff,
15363
- darkslategrey: 0x2f4f4fff,
15364
- darkturquoise: 0x00ced1ff,
15365
- darkviolet: 0x9400d3ff,
15366
- deeppink: 0xff1493ff,
15367
- deepskyblue: 0x00bfffff,
15368
- dimgray: 0x696969ff,
15369
- dimgrey: 0x696969ff,
15370
- dodgerblue: 0x1e90ffff,
15371
- firebrick: 0xb22222ff,
15372
- floralwhite: 0xfffaf0ff,
15373
- forestgreen: 0x228b22ff,
15374
- fuchsia: 0xff00ffff,
15375
- gainsboro: 0xdcdcdcff,
15376
- ghostwhite: 0xf8f8ffff,
15377
- gold: 0xffd700ff,
15378
- goldenrod: 0xdaa520ff,
15379
- gray: 0x808080ff,
15380
- green: 0x008000ff,
15381
- greenyellow: 0xadff2fff,
15382
- grey: 0x808080ff,
15383
- honeydew: 0xf0fff0ff,
15384
- hotpink: 0xff69b4ff,
15385
- indianred: 0xcd5c5cff,
15386
- indigo: 0x4b0082ff,
15387
- ivory: 0xfffff0ff,
15388
- khaki: 0xf0e68cff,
15389
- lavender: 0xe6e6faff,
15390
- lavenderblush: 0xfff0f5ff,
15391
- lawngreen: 0x7cfc00ff,
15392
- lemonchiffon: 0xfffacdff,
15393
- lightblue: 0xadd8e6ff,
15394
- lightcoral: 0xf08080ff,
15395
- lightcyan: 0xe0ffffff,
15396
- lightgoldenrodyellow: 0xfafad2ff,
15397
- lightgray: 0xd3d3d3ff,
15398
- lightgreen: 0x90ee90ff,
15399
- lightgrey: 0xd3d3d3ff,
15400
- lightpink: 0xffb6c1ff,
15401
- lightsalmon: 0xffa07aff,
15402
- lightseagreen: 0x20b2aaff,
15403
- lightskyblue: 0x87cefaff,
15404
- lightslategray: 0x778899ff,
15405
- lightslategrey: 0x778899ff,
15406
- lightsteelblue: 0xb0c4deff,
15407
- lightyellow: 0xffffe0ff,
15408
- lime: 0x00ff00ff,
15409
- limegreen: 0x32cd32ff,
15410
- linen: 0xfaf0e6ff,
15411
- magenta: 0xff00ffff,
15412
- maroon: 0x800000ff,
15413
- mediumaquamarine: 0x66cdaaff,
15414
- mediumblue: 0x0000cdff,
15415
- mediumorchid: 0xba55d3ff,
15416
- mediumpurple: 0x9370dbff,
15417
- mediumseagreen: 0x3cb371ff,
15418
- mediumslateblue: 0x7b68eeff,
15419
- mediumspringgreen: 0x00fa9aff,
15420
- mediumturquoise: 0x48d1ccff,
15421
- mediumvioletred: 0xc71585ff,
15422
- midnightblue: 0x191970ff,
15423
- mintcream: 0xf5fffaff,
15424
- mistyrose: 0xffe4e1ff,
15425
- moccasin: 0xffe4b5ff,
15426
- navajowhite: 0xffdeadff,
15427
- navy: 0x000080ff,
15428
- oldlace: 0xfdf5e6ff,
15429
- olive: 0x808000ff,
15430
- olivedrab: 0x6b8e23ff,
15431
- orange: 0xffa500ff,
15432
- orangered: 0xff4500ff,
15433
- orchid: 0xda70d6ff,
15434
- palegoldenrod: 0xeee8aaff,
15435
- palegreen: 0x98fb98ff,
15436
- paleturquoise: 0xafeeeeff,
15437
- palevioletred: 0xdb7093ff,
15438
- papayawhip: 0xffefd5ff,
15439
- peachpuff: 0xffdab9ff,
15440
- peru: 0xcd853fff,
15441
- pink: 0xffc0cbff,
15442
- plum: 0xdda0ddff,
15443
- powderblue: 0xb0e0e6ff,
15444
- purple: 0x800080ff,
15445
- rebeccapurple: 0x663399ff,
15446
- red: 0xff0000ff,
15447
- rosybrown: 0xbc8f8fff,
15448
- royalblue: 0x4169e1ff,
15449
- saddlebrown: 0x8b4513ff,
15450
- salmon: 0xfa8072ff,
15451
- sandybrown: 0xf4a460ff,
15452
- seagreen: 0x2e8b57ff,
15453
- seashell: 0xfff5eeff,
15454
- sienna: 0xa0522dff,
15455
- silver: 0xc0c0c0ff,
15456
- skyblue: 0x87ceebff,
15457
- slateblue: 0x6a5acdff,
15458
- slategray: 0x708090ff,
15459
- slategrey: 0x708090ff,
15460
- snow: 0xfffafaff,
15461
- springgreen: 0x00ff7fff,
15462
- steelblue: 0x4682b4ff,
15463
- tan: 0xd2b48cff,
15464
- teal: 0x008080ff,
15465
- thistle: 0xd8bfd8ff,
15466
- tomato: 0xff6347ff,
15467
- turquoise: 0x40e0d0ff,
15468
- violet: 0xee82eeff,
15469
- wheat: 0xf5deb3ff,
15470
- white: 0xffffffff,
15471
- whitesmoke: 0xf5f5f5ff,
15472
- yellow: 0xffff00ff,
15473
- yellowgreen: 0x9acd32ff
15474
- };
15475
-
15476
- const NUMBER = '[-+]?\\d*\\.?\\d+';
15477
- const PERCENTAGE = NUMBER + '%';
15478
-
15479
- function call(...parts) {
15480
- return '\\(\\s*(' + parts.join(')\\s*,\\s*(') + ')\\s*\\)';
15481
- }
15482
-
15483
- const rgb = new RegExp('rgb' + call(NUMBER, NUMBER, NUMBER));
15484
- const rgba = new RegExp('rgba' + call(NUMBER, NUMBER, NUMBER, NUMBER));
15485
- const hsl = new RegExp('hsl' + call(NUMBER, PERCENTAGE, PERCENTAGE));
15486
- const hsla = new RegExp('hsla' + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER));
15487
- const hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
15488
- const hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
15489
- const hex6 = /^#([0-9a-fA-F]{6})$/;
15490
- const hex8 = /^#([0-9a-fA-F]{8})$/;
15491
-
15492
- function normalizeColor(color) {
15493
- let match;
15494
-
15495
- if (typeof color === 'number') {
15496
- return color >>> 0 === color && color >= 0 && color <= 0xffffffff ? color : null;
15497
- }
15498
-
15499
- if (match = hex6.exec(color)) return parseInt(match[1] + 'ff', 16) >>> 0;
15500
-
15501
- if (colors$1 && colors$1[color] !== undefined) {
15502
- return colors$1[color];
15503
- }
15504
-
15505
- if (match = rgb.exec(color)) {
15506
- return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | 0x000000ff) >>> 0;
15507
- }
15508
-
15509
- if (match = rgba.exec(color)) {
15510
- return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | parse1(match[4])) >>> 0;
15511
- }
15512
-
15513
- if (match = hex3.exec(color)) {
15514
- return parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + 'ff', 16) >>> 0;
15515
- }
15516
-
15517
- if (match = hex8.exec(color)) return parseInt(match[1], 16) >>> 0;
15518
-
15519
- if (match = hex4.exec(color)) {
15520
- return parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + match[4] + match[4], 16) >>> 0;
15521
- }
15522
-
15523
- if (match = hsl.exec(color)) {
15524
- return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | 0x000000ff) >>> 0;
15525
- }
15526
-
15527
- if (match = hsla.exec(color)) {
15528
- return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | parse1(match[4])) >>> 0;
15529
- }
15530
-
15531
- return null;
15532
- }
15533
-
15534
- function hue2rgb(p, q, t) {
15535
- if (t < 0) t += 1;
15536
- if (t > 1) t -= 1;
15537
- if (t < 1 / 6) return p + (q - p) * 6 * t;
15538
- if (t < 1 / 2) return q;
15539
- if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
15540
- return p;
15541
- }
15542
-
15543
- function hslToRgb(h, s, l) {
15544
- const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
15545
- const p = 2 * l - q;
15546
- const r = hue2rgb(p, q, h + 1 / 3);
15547
- const g = hue2rgb(p, q, h);
15548
- const b = hue2rgb(p, q, h - 1 / 3);
15549
- return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;
15550
- }
15551
-
15552
- function parse255(str) {
15553
- const int = parseInt(str, 10);
15554
- if (int < 0) return 0;
15555
- if (int > 255) return 255;
15556
- return int;
15557
- }
15558
-
15559
- function parse360(str) {
15560
- const int = parseFloat(str);
15561
- return (int % 360 + 360) % 360 / 360;
15562
- }
15563
-
15564
- function parse1(str) {
15565
- const num = parseFloat(str);
15566
- if (num < 0) return 0;
15567
- if (num > 1) return 255;
15568
- return Math.round(num * 255);
15569
- }
15570
-
15571
- function parsePercentage(str) {
15572
- const int = parseFloat(str);
15573
- if (int < 0) return 0;
15574
- if (int > 100) return 1;
15575
- return int / 100;
15576
- }
15577
 
15578
- function colorToRgba(input) {
15579
- let int32Color = normalizeColor(input);
15580
- if (int32Color === null) return input;
15581
- int32Color = int32Color || 0;
15582
- let r = (int32Color & 0xff000000) >>> 24;
15583
- let g = (int32Color & 0x00ff0000) >>> 16;
15584
- let b = (int32Color & 0x0000ff00) >>> 8;
15585
- let a = (int32Color & 0x000000ff) / 255;
15586
- return `rgba(${r}, ${g}, ${b}, ${a})`;
15587
  }
 
 
 
 
 
 
 
15588
 
15589
- const createInterpolator = (range, output, extrapolate) => {
15590
- if (react_spring_shared_esm_is.fun(range)) {
15591
- return range;
15592
- }
15593
-
15594
- if (react_spring_shared_esm_is.arr(range)) {
15595
- return createInterpolator({
15596
- range,
15597
- output: output,
15598
- extrapolate
15599
- });
15600
- }
15601
 
15602
- if (react_spring_shared_esm_is.str(range.output[0])) {
15603
- return createStringInterpolator$1(range);
15604
- }
15605
 
15606
- const config = range;
15607
- const outputRange = config.output;
15608
- const inputRange = config.range || [0, 1];
15609
- const extrapolateLeft = config.extrapolateLeft || config.extrapolate || 'extend';
15610
- const extrapolateRight = config.extrapolateRight || config.extrapolate || 'extend';
15611
 
15612
- const easing = config.easing || (t => t);
 
 
15613
 
15614
- return input => {
15615
- const range = findRange(input, inputRange);
15616
- return interpolate(input, inputRange[range], inputRange[range + 1], outputRange[range], outputRange[range + 1], easing, extrapolateLeft, extrapolateRight, config.map);
15617
- };
15618
- };
15619
 
15620
- function interpolate(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight, map) {
15621
- let result = map ? map(input) : input;
 
 
 
 
 
 
15622
 
15623
- if (result < inputMin) {
15624
- if (extrapolateLeft === 'identity') return result;else if (extrapolateLeft === 'clamp') result = inputMin;
15625
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15626
 
15627
- if (result > inputMax) {
15628
- if (extrapolateRight === 'identity') return result;else if (extrapolateRight === 'clamp') result = inputMax;
15629
- }
15630
 
15631
- if (outputMin === outputMax) return outputMin;
15632
- if (inputMin === inputMax) return input <= inputMin ? outputMin : outputMax;
15633
- if (inputMin === -Infinity) result = -result;else if (inputMax === Infinity) result = result - inputMin;else result = (result - inputMin) / (inputMax - inputMin);
15634
- result = easing(result);
15635
- if (outputMin === -Infinity) result = -result;else if (outputMax === Infinity) result = result + outputMin;else result = result * (outputMax - outputMin) + outputMin;
15636
- return result;
15637
- }
15638
 
15639
- function findRange(input, inputRange) {
15640
- for (var i = 1; i < inputRange.length - 1; ++i) if (inputRange[i] >= input) break;
 
15641
 
15642
- return i - 1;
15643
- }
 
15644
 
15645
- function react_spring_shared_esm_extends() {
15646
- react_spring_shared_esm_extends = Object.assign || function (target) {
15647
- for (var i = 1; i < arguments.length; i++) {
15648
- var source = arguments[i];
15649
 
15650
- for (var key in source) {
15651
- if (Object.prototype.hasOwnProperty.call(source, key)) {
15652
- target[key] = source[key];
15653
- }
15654
  }
15655
  }
 
 
 
 
 
 
15656
 
15657
- return target;
15658
- };
15659
 
15660
- return react_spring_shared_esm_extends.apply(this, arguments);
 
 
 
 
 
 
 
 
 
 
15661
  }
 
 
 
 
 
15662
 
15663
- const $get = Symbol.for('FluidValue.get');
15664
- const $observers = Symbol.for('FluidValue.observers');
15665
 
15666
- const hasFluidValue = arg => Boolean(arg && arg[$get]);
 
 
15667
 
15668
- const getFluidValue = arg => arg && arg[$get] ? arg[$get]() : arg;
15669
 
15670
- const getFluidObservers = target => target[$observers] || null;
 
 
 
 
15671
 
15672
- function callFluidObserver(observer, event) {
15673
- if (observer.eventObserved) {
15674
- observer.eventObserved(event);
15675
- } else {
15676
- observer(event);
15677
- }
15678
- }
 
 
 
 
 
 
 
 
 
15679
 
15680
- function callFluidObservers(target, event) {
15681
- let observers = target[$observers];
 
 
 
 
 
15682
 
15683
- if (observers) {
15684
- observers.forEach(observer => {
15685
- callFluidObserver(observer, event);
15686
- });
15687
- }
15688
  }
 
 
 
 
 
 
 
 
15689
 
15690
- class FluidValue {
15691
- constructor(get) {
15692
- this[$get] = void 0;
15693
- this[$observers] = void 0;
15694
 
15695
- if (!get && !(get = this.get)) {
15696
- throw Error('Unknown getter');
15697
- }
15698
 
15699
- setFluidGetter(this, get);
15700
- }
15701
 
15702
- }
15703
 
15704
- const setFluidGetter = (target, get) => setHidden(target, $get, get);
15705
 
15706
- function addFluidObserver(target, observer) {
15707
- if (target[$get]) {
15708
- let observers = target[$observers];
15709
 
15710
- if (!observers) {
15711
- setHidden(target, $observers, observers = new Set());
15712
- }
15713
 
15714
- if (!observers.has(observer)) {
15715
- observers.add(observer);
 
 
 
 
 
 
 
 
 
15716
 
15717
- if (target.observerAdded) {
15718
- target.observerAdded(observers.size, observer);
15719
- }
15720
  }
15721
- }
15722
 
15723
- return observer;
15724
- }
15725
 
15726
- function removeFluidObserver(target, observer) {
15727
- let observers = target[$observers];
 
 
15728
 
15729
- if (observers && observers.has(observer)) {
15730
- const count = observers.size - 1;
15731
 
15732
- if (count) {
15733
- observers.delete(observer);
15734
- } else {
15735
- target[$observers] = null;
15736
  }
15737
 
15738
- if (target.observerRemoved) {
15739
- target.observerRemoved(count, observer);
15740
- }
15741
- }
15742
- }
15743
 
15744
- const setHidden = (target, key, value) => Object.defineProperty(target, key, {
15745
- value,
15746
- writable: true,
15747
- configurable: true
15748
- });
15749
 
15750
- const numberRegex = /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;
15751
- const colorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi;
15752
- let namedColorRegex;
15753
- const rgbaRegex = /rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi;
 
 
 
 
15754
 
15755
- const rgbaRound = (_, p1, p2, p3, p4) => `rgba(${Math.round(p1)}, ${Math.round(p2)}, ${Math.round(p3)}, ${p4})`;
15756
 
15757
- const createStringInterpolator = config => {
15758
- if (!namedColorRegex) namedColorRegex = colors$1 ? new RegExp(`(${Object.keys(colors$1).join('|')})(?!\\w)`, 'g') : /^\b$/;
15759
- const output = config.output.map(value => getFluidValue(value).replace(colorRegex, colorToRgba).replace(namedColorRegex, colorToRgba));
15760
- const keyframes = output.map(value => value.match(numberRegex).map(Number));
15761
- const outputRanges = keyframes[0].map((_, i) => keyframes.map(values => {
15762
- if (!(i in values)) {
15763
- throw Error('The arity of each "output" value must be equal');
15764
- }
15765
 
15766
- return values[i];
15767
- }));
15768
- const interpolators = outputRanges.map(output => createInterpolator(react_spring_shared_esm_extends({}, config, {
15769
- output
15770
- })));
15771
- return input => {
15772
- let i = 0;
15773
- return output[0].replace(numberRegex, () => String(interpolators[i++](input))).replace(rgbaRegex, rgbaRound);
15774
- };
15775
- };
 
 
 
 
 
 
 
15776
 
15777
- const prefix = 'react-spring: ';
15778
 
15779
- const once = fn => {
15780
- const func = fn;
15781
- let called = false;
15782
 
15783
- if (typeof func != 'function') {
15784
- throw new TypeError(`${prefix}once requires a function parameter`);
15785
- }
15786
 
15787
- return (...args) => {
15788
- if (!called) {
15789
- func(...args);
15790
- called = true;
15791
- }
15792
- };
15793
- };
15794
 
15795
- const warnInterpolate = once(console.warn);
15796
- function react_spring_shared_esm_deprecateInterpolate() {
15797
- warnInterpolate(`${prefix}The "interpolate" function is deprecated in v9 (use "to" instead)`);
15798
- }
15799
- const warnDirectCall = once(console.warn);
15800
- function deprecateDirectCall() {
15801
- warnDirectCall(`${prefix}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`);
15802
- }
15803
 
15804
- function isAnimatedString(value) {
15805
- return react_spring_shared_esm_is.str(value) && (value[0] == '#' || /\d/.test(value) || value in (colors$1 || {}));
15806
- }
 
 
 
 
15807
 
15808
- const react_spring_shared_esm_useOnce = effect => (0,external_React_.useEffect)(effect, emptyDeps);
15809
- const emptyDeps = [];
 
 
 
 
 
 
 
 
 
 
 
 
 
15810
 
15811
- function react_spring_shared_esm_useForceUpdate() {
15812
- const update = (0,external_React_.useState)()[1];
15813
- const mounted = (0,external_React_.useState)(makeMountedRef)[0];
15814
- react_spring_shared_esm_useOnce(mounted.unmount);
15815
- return () => {
15816
- if (mounted.current) {
15817
- update({});
15818
- }
15819
- };
15820
  }
 
 
 
 
 
 
 
 
15821
 
15822
- function makeMountedRef() {
15823
- const mounted = {
15824
- current: true,
15825
- unmount: () => () => {
15826
- mounted.current = false;
15827
- }
15828
- };
15829
- return mounted;
15830
- }
15831
 
15832
- function useMemoOne(getResult, inputs) {
15833
- const [initial] = (0,external_React_.useState)(() => ({
15834
- inputs,
15835
- result: getResult()
15836
- }));
15837
- const committed = (0,external_React_.useRef)();
15838
- const prevCache = committed.current;
15839
- let cache = prevCache;
15840
 
15841
- if (cache) {
15842
- const useCache = Boolean(inputs && cache.inputs && areInputsEqual(inputs, cache.inputs));
 
 
 
15843
 
15844
- if (!useCache) {
15845
- cache = {
15846
- inputs,
15847
- result: getResult()
15848
- };
15849
  }
15850
- } else {
15851
- cache = initial;
15852
- }
15853
-
15854
- (0,external_React_.useEffect)(() => {
15855
- committed.current = cache;
15856
 
15857
- if (prevCache == initial) {
15858
- initial.inputs = initial.result = undefined;
15859
- }
15860
- }, [cache]);
15861
- return cache.result;
15862
  }
 
 
 
 
 
 
 
 
15863
 
15864
- function areInputsEqual(next, prev) {
15865
- if (next.length !== prev.length) {
15866
- return false;
15867
- }
15868
 
15869
- for (let i = 0; i < next.length; i++) {
15870
- if (next[i] !== prev[i]) {
15871
- return false;
 
 
 
 
 
 
15872
  }
15873
- }
15874
-
15875
- return true;
15876
- }
15877
 
15878
- function react_spring_shared_esm_usePrev(value) {
15879
- const prevRef = (0,external_React_.useRef)();
15880
- (0,external_React_.useEffect)(() => {
15881
- prevRef.current = value;
15882
- });
15883
- return prevRef.current;
15884
  }
15885
 
15886
- const react_spring_shared_esm_useLayoutEffect = typeof window !== 'undefined' && window.document && window.document.createElement ? external_React_.useLayoutEffect : external_React_.useEffect;
15887
-
15888
 
15889
 
15890
- ;// CONCATENATED MODULE: ./node_modules/@react-spring/animated/dist/react-spring-animated.esm.js
 
 
 
 
15891
 
15892
 
 
 
 
15893
 
15894
 
15895
- const $node = Symbol.for('Animated:node');
15896
- const isAnimated = value => !!value && value[$node] === value;
15897
- const getAnimated = owner => owner && owner[$node];
15898
- const setAnimated = (owner, node) => defineHidden(owner, $node, node);
15899
- const getPayload = owner => owner && owner[$node] && owner[$node].getPayload();
15900
- class Animated {
15901
- constructor() {
15902
- this.payload = void 0;
15903
- setAnimated(this, this);
15904
- }
15905
 
15906
- getPayload() {
15907
- return this.payload || [];
15908
- }
15909
 
 
 
 
 
 
 
 
 
15910
  }
 
 
 
 
 
15911
 
15912
- class AnimatedValue extends Animated {
15913
- constructor(_value) {
15914
- super();
15915
- this.done = true;
15916
- this.elapsedTime = void 0;
15917
- this.lastPosition = void 0;
15918
- this.lastVelocity = void 0;
15919
- this.v0 = void 0;
15920
- this.durationProgress = 0;
15921
- this._value = _value;
15922
 
15923
- if (react_spring_shared_esm_is.num(this._value)) {
15924
- this.lastPosition = this._value;
15925
- }
15926
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15927
 
15928
- static create(value) {
15929
- return new AnimatedValue(value);
15930
- }
 
 
15931
 
15932
- getPayload() {
15933
- return [this];
15934
- }
 
15935
 
15936
- getValue() {
15937
- return this._value;
15938
- }
15939
 
15940
- setValue(value, step) {
15941
- if (react_spring_shared_esm_is.num(value)) {
15942
- this.lastPosition = value;
 
 
 
15943
 
15944
- if (step) {
15945
- value = Math.round(value / step) * step;
15946
 
15947
- if (this.done) {
15948
- this.lastPosition = value;
 
 
 
 
 
 
 
15949
  }
 
 
 
 
 
15950
  }
15951
  }
15952
 
15953
- if (this._value === value) {
15954
- return false;
15955
- }
15956
-
15957
- this._value = value;
15958
- return true;
15959
- }
15960
 
15961
- reset() {
15962
- const {
15963
- done
15964
- } = this;
15965
- this.done = false;
15966
 
15967
- if (react_spring_shared_esm_is.num(this._value)) {
15968
- this.elapsedTime = 0;
15969
- this.durationProgress = 0;
15970
- this.lastPosition = this._value;
15971
- if (done) this.lastVelocity = null;
15972
- this.v0 = null;
15973
  }
15974
- }
15975
 
15976
- }
 
 
 
 
 
 
 
15977
 
15978
- class AnimatedString extends AnimatedValue {
15979
- constructor(value) {
15980
- super(0);
15981
- this._string = null;
15982
- this._toString = void 0;
15983
- this._toString = createInterpolator({
15984
- output: [value, value]
15985
- });
15986
- }
15987
 
15988
- static create(value) {
15989
- return new AnimatedString(value);
15990
- }
 
15991
 
15992
- getValue() {
15993
- let value = this._string;
15994
- return value == null ? this._string = this._toString(this._value) : value;
15995
- }
 
 
 
 
 
 
15996
 
15997
- setValue(value) {
15998
- if (react_spring_shared_esm_is.str(value)) {
15999
- if (value == this._string) {
16000
- return false;
 
 
 
 
16001
  }
16002
 
16003
- this._string = value;
16004
- this._value = 1;
16005
- } else if (super.setValue(value)) {
16006
- this._string = null;
16007
- } else {
16008
- return false;
16009
- }
16010
 
16011
- return true;
16012
- }
16013
 
16014
- reset(goal) {
16015
- if (goal) {
16016
- this._toString = createInterpolator({
16017
- output: [this.getValue(), goal]
16018
- });
 
 
 
 
 
 
 
 
 
 
 
 
16019
  }
16020
 
16021
- this._value = 0;
16022
- super.reset();
16023
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16024
 
 
 
 
 
 
 
 
 
 
 
 
16025
  }
 
 
 
 
 
16026
 
16027
- const TreeContext = {
16028
- dependencies: null
16029
- };
16030
 
16031
- class AnimatedObject extends Animated {
16032
- constructor(source) {
16033
- super();
16034
- this.source = source;
16035
- this.setValue(source);
16036
- }
16037
 
16038
- getValue(animated) {
16039
- const values = {};
16040
- eachProp(this.source, (source, key) => {
16041
- if (isAnimated(source)) {
16042
- values[key] = source.getValue(animated);
16043
- } else if (hasFluidValue(source)) {
16044
- values[key] = getFluidValue(source);
16045
- } else if (!animated) {
16046
- values[key] = source;
16047
- }
16048
- });
16049
- return values;
16050
- }
16051
 
16052
- setValue(source) {
16053
- this.source = source;
16054
- this.payload = this._makePayload(source);
16055
- }
16056
 
16057
- reset() {
16058
- if (this.payload) {
16059
- react_spring_shared_esm_each(this.payload, node => node.reset());
16060
- }
16061
- }
16062
 
16063
- _makePayload(source) {
16064
- if (source) {
16065
- const payload = new Set();
16066
- eachProp(source, this._addToPayload, payload);
16067
- return Array.from(payload);
16068
- }
16069
- }
16070
 
16071
- _addToPayload(source) {
16072
- if (TreeContext.dependencies && hasFluidValue(source)) {
16073
- TreeContext.dependencies.add(source);
16074
- }
16075
 
16076
- const payload = getPayload(source);
 
 
16077
 
16078
- if (payload) {
16079
- react_spring_shared_esm_each(payload, node => this.add(node));
16080
- }
16081
- }
16082
 
16083
- }
16084
 
16085
- class AnimatedArray extends AnimatedObject {
16086
- constructor(source) {
16087
- super(source);
16088
- }
16089
 
16090
- static create(source) {
16091
- return new AnimatedArray(source);
16092
- }
16093
 
16094
- getValue() {
16095
- return this.source.map(node => node.getValue());
16096
- }
16097
 
16098
- setValue(source) {
16099
- const payload = this.getPayload();
16100
 
16101
- if (source.length == payload.length) {
16102
- return payload.map((node, i) => node.setValue(source[i])).some(Boolean);
16103
- }
16104
 
16105
- super.setValue(source.map(makeAnimated));
16106
- return true;
16107
- }
16108
 
16109
- }
16110
 
16111
- function makeAnimated(value) {
16112
- const nodeType = isAnimatedString(value) ? AnimatedString : AnimatedValue;
16113
- return nodeType.create(value);
16114
- }
16115
 
16116
- function getAnimatedType(value) {
16117
- const parentNode = getAnimated(value);
16118
- return parentNode ? parentNode.constructor : react_spring_shared_esm_is.arr(value) ? AnimatedArray : isAnimatedString(value) ? AnimatedString : AnimatedValue;
16119
- }
16120
 
16121
- function react_spring_animated_esm_extends() {
16122
- react_spring_animated_esm_extends = Object.assign || function (target) {
16123
- for (var i = 1; i < arguments.length; i++) {
16124
- var source = arguments[i];
16125
 
16126
- for (var key in source) {
16127
- if (Object.prototype.hasOwnProperty.call(source, key)) {
16128
- target[key] = source[key];
16129
- }
16130
- }
16131
- }
16132
 
16133
- return target;
16134
- };
16135
 
16136
- return react_spring_animated_esm_extends.apply(this, arguments);
16137
- }
16138
 
16139
- const withAnimated = (Component, host) => {
16140
- const hasInstance = !react_spring_shared_esm_is.fun(Component) || Component.prototype && Component.prototype.isReactComponent;
16141
- return (0,external_React_.forwardRef)((givenProps, givenRef) => {
16142
- const instanceRef = (0,external_React_.useRef)(null);
16143
- const ref = hasInstance && (0,external_React_.useCallback)(value => {
16144
- instanceRef.current = updateRef(givenRef, value);
16145
- }, [givenRef]);
16146
- const [props, deps] = getAnimatedState(givenProps, host);
16147
- const forceUpdate = react_spring_shared_esm_useForceUpdate();
16148
 
16149
- const callback = () => {
16150
- const instance = instanceRef.current;
16151
 
16152
- if (hasInstance && !instance) {
16153
- return;
16154
- }
 
16155
 
16156
- const didUpdate = instance ? host.applyAnimatedValues(instance, props.getValue(true)) : false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16157
 
16158
- if (didUpdate === false) {
16159
- forceUpdate();
16160
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16161
  };
 
16162
 
16163
- const observer = new PropsObserver(callback, deps);
16164
- const observerRef = (0,external_React_.useRef)();
16165
- react_spring_shared_esm_useLayoutEffect(() => {
16166
- const lastObserver = observerRef.current;
16167
- observerRef.current = observer;
16168
- react_spring_shared_esm_each(deps, dep => addFluidObserver(dep, observer));
16169
-
16170
- if (lastObserver) {
16171
- react_spring_shared_esm_each(lastObserver.deps, dep => removeFluidObserver(dep, lastObserver));
16172
- raf.cancel(lastObserver.update);
16173
- }
16174
- });
16175
- (0,external_React_.useEffect)(callback, []);
16176
- react_spring_shared_esm_useOnce(() => () => {
16177
- const observer = observerRef.current;
16178
- react_spring_shared_esm_each(observer.deps, dep => removeFluidObserver(dep, observer));
16179
- });
16180
- const usedProps = host.getComponentProps(props.getValue());
16181
- return external_React_.createElement(Component, react_spring_animated_esm_extends({}, usedProps, {
16182
- ref: ref
16183
- }));
16184
- });
16185
- };
16186
 
16187
- class PropsObserver {
16188
- constructor(update, deps) {
16189
- this.update = update;
16190
- this.deps = deps;
16191
  }
16192
 
16193
- eventObserved(event) {
16194
- if (event.type == 'change') {
16195
- raf.write(this.update);
 
 
 
 
 
 
 
 
 
 
 
 
 
16196
  }
16197
- }
16198
-
16199
  }
 
 
 
 
 
16200
 
16201
- function getAnimatedState(props, host) {
16202
- const dependencies = new Set();
16203
- TreeContext.dependencies = dependencies;
16204
- if (props.style) props = react_spring_animated_esm_extends({}, props, {
16205
- style: host.createAnimatedStyle(props.style)
16206
- });
16207
- props = new AnimatedObject(props);
16208
- TreeContext.dependencies = null;
16209
- return [props, dependencies];
16210
- }
16211
 
16212
- function updateRef(ref, value) {
16213
- if (ref) {
16214
- if (react_spring_shared_esm_is.fun(ref)) ref(value);else ref.current = value;
16215
- }
16216
 
16217
- return value;
16218
- }
 
16219
 
16220
- const cacheKey = Symbol.for('AnimatedComponent');
16221
- const createHost = (components, {
16222
- applyAnimatedValues: _applyAnimatedValues = () => false,
16223
- createAnimatedStyle: _createAnimatedStyle = style => new AnimatedObject(style),
16224
- getComponentProps: _getComponentProps = props => props
16225
- } = {}) => {
16226
- const hostConfig = {
16227
- applyAnimatedValues: _applyAnimatedValues,
16228
- createAnimatedStyle: _createAnimatedStyle,
16229
- getComponentProps: _getComponentProps
16230
- };
16231
 
16232
- const animated = Component => {
16233
- const displayName = getDisplayName(Component) || 'Anonymous';
 
16234
 
16235
- if (react_spring_shared_esm_is.str(Component)) {
16236
- Component = animated[Component] || (animated[Component] = withAnimated(Component, hostConfig));
16237
- } else {
16238
- Component = Component[cacheKey] || (Component[cacheKey] = withAnimated(Component, hostConfig));
16239
- }
16240
 
16241
- Component.displayName = `Animated(${displayName})`;
16242
- return Component;
16243
- };
16244
 
16245
- eachProp(components, (Component, key) => {
16246
- if (react_spring_shared_esm_is.arr(components)) {
16247
- key = getDisplayName(Component);
16248
- }
16249
 
16250
- animated[key] = animated(Component);
16251
- });
16252
- return {
16253
- animated
16254
- };
16255
- };
16256
 
16257
- const getDisplayName = arg => react_spring_shared_esm_is.str(arg) ? arg : arg && react_spring_shared_esm_is.str(arg.displayName) ? arg.displayName : react_spring_shared_esm_is.fun(arg) && arg.name || null;
16258
 
16259
 
 
 
 
16260
 
16261
- ;// CONCATENATED MODULE: ./node_modules/@react-spring/core/dist/react-spring-core.esm.js
16262
 
16263
 
16264
 
@@ -16266,3741 +15977,3209 @@ const getDisplayName = arg => react_spring_shared_esm_is.str(arg) ? arg : arg &&
16266
 
16267
 
16268
 
 
 
 
 
 
 
 
 
 
16269
 
16270
- function react_spring_core_esm_extends() {
16271
- react_spring_core_esm_extends = Object.assign || function (target) {
16272
- for (var i = 1; i < arguments.length; i++) {
16273
- var source = arguments[i];
16274
 
16275
- for (var key in source) {
16276
- if (Object.prototype.hasOwnProperty.call(source, key)) {
16277
- target[key] = source[key];
16278
- }
16279
- }
16280
- }
16281
 
16282
- return target;
16283
- };
 
 
 
16284
 
16285
- return react_spring_core_esm_extends.apply(this, arguments);
16286
  }
16287
 
16288
- function callProp(value, ...args) {
16289
- return react_spring_shared_esm_is.fun(value) ? value(...args) : value;
 
 
 
 
 
 
16290
  }
16291
- const matchProp = (value, key) => value === true || !!(key && value && (react_spring_shared_esm_is.fun(value) ? value(key) : react_spring_shared_esm_toArray(value).includes(key)));
16292
- const resolveProp = (prop, key) => react_spring_shared_esm_is.obj(prop) ? key && prop[key] : prop;
16293
- const getDefaultProp = (props, key) => props.default === true ? props[key] : props.default ? props.default[key] : undefined;
16294
 
16295
- const noopTransform = value => value;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16296
 
16297
- const getDefaultProps = (props, transform = noopTransform) => {
16298
- let keys = DEFAULT_PROPS;
 
 
 
 
 
 
 
 
 
 
 
 
16299
 
16300
- if (props.default && props.default !== true) {
16301
- props = props.default;
16302
- keys = Object.keys(props);
16303
  }
16304
 
16305
- const defaults = {};
16306
-
16307
- for (const key of keys) {
16308
- const value = transform(props[key], key);
16309
 
16310
- if (!react_spring_shared_esm_is.und(value)) {
16311
- defaults[key] = value;
16312
- }
 
 
16313
  }
16314
 
16315
- return defaults;
16316
- };
16317
- const DEFAULT_PROPS = ['config', 'onProps', 'onStart', 'onChange', 'onPause', 'onResume', 'onRest'];
16318
- const RESERVED_PROPS = {
16319
- config: 1,
16320
- from: 1,
16321
- to: 1,
16322
- ref: 1,
16323
- loop: 1,
16324
- reset: 1,
16325
- pause: 1,
16326
- cancel: 1,
16327
- reverse: 1,
16328
- immediate: 1,
16329
- default: 1,
16330
- delay: 1,
16331
- onProps: 1,
16332
- onStart: 1,
16333
- onChange: 1,
16334
- onPause: 1,
16335
- onResume: 1,
16336
- onRest: 1,
16337
- onResolve: 1,
16338
- items: 1,
16339
- trail: 1,
16340
- sort: 1,
16341
- expires: 1,
16342
- initial: 1,
16343
- enter: 1,
16344
- update: 1,
16345
- leave: 1,
16346
- children: 1,
16347
- onDestroyed: 1,
16348
- keys: 1,
16349
- callId: 1,
16350
- parentId: 1
16351
- };
16352
-
16353
- function getForwardProps(props) {
16354
- const forward = {};
16355
- let count = 0;
16356
- eachProp(props, (value, prop) => {
16357
- if (!RESERVED_PROPS[prop]) {
16358
- forward[prop] = value;
16359
- count++;
16360
- }
16361
- });
16362
 
16363
- if (count) {
16364
- return forward;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16365
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16366
  }
16367
 
16368
- function inferTo(props) {
16369
- const to = getForwardProps(props);
 
 
 
 
 
 
 
 
 
 
 
16370
 
16371
- if (to) {
16372
- const out = {
16373
- to
16374
- };
16375
- eachProp(props, (val, key) => key in to || (out[key] = val));
16376
- return out;
16377
- }
16378
 
16379
- return react_spring_core_esm_extends({}, props);
16380
- }
16381
- function computeGoal(value) {
16382
- value = getFluidValue(value);
16383
- return react_spring_shared_esm_is.arr(value) ? value.map(computeGoal) : isAnimatedString(value) ? globals.createStringInterpolator({
16384
- range: [0, 1],
16385
- output: [value, value]
16386
- })(1) : value;
16387
- }
16388
- function hasProps(props) {
16389
- for (const _ in props) return true;
16390
 
16391
- return false;
16392
- }
16393
- function isAsyncTo(to) {
16394
- return react_spring_shared_esm_is.fun(to) || react_spring_shared_esm_is.arr(to) && react_spring_shared_esm_is.obj(to[0]);
16395
- }
16396
- function detachRefs(ctrl, ref) {
16397
- var _ctrl$ref;
16398
 
16399
- (_ctrl$ref = ctrl.ref) == null ? void 0 : _ctrl$ref.delete(ctrl);
16400
- ref == null ? void 0 : ref.delete(ctrl);
16401
- }
16402
- function replaceRef(ctrl, ref) {
16403
- if (ref && ctrl.ref !== ref) {
16404
- var _ctrl$ref2;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16405
 
16406
- (_ctrl$ref2 = ctrl.ref) == null ? void 0 : _ctrl$ref2.delete(ctrl);
16407
- ref.add(ctrl);
16408
- ctrl.ref = ref;
16409
- }
16410
- }
 
 
 
 
 
 
 
16411
 
16412
- function useChain(refs, timeSteps, timeFrame = 1000) {
16413
- useLayoutEffect(() => {
16414
- if (timeSteps) {
16415
- let prevDelay = 0;
16416
- each(refs, (ref, i) => {
16417
- const controllers = ref.current;
16418
 
16419
- if (controllers.length) {
16420
- let delay = timeFrame * timeSteps[i];
16421
- if (isNaN(delay)) delay = prevDelay;else prevDelay = delay;
16422
- each(controllers, ctrl => {
16423
- each(ctrl.queue, props => {
16424
- const memoizedDelayProp = props.delay;
 
 
 
 
 
16425
 
16426
- props.delay = key => delay + callProp(memoizedDelayProp || 0, key);
16427
- });
16428
- ctrl.start();
16429
- });
 
 
 
 
 
 
 
 
 
 
16430
  }
16431
- });
16432
- } else {
16433
- let p = Promise.resolve();
16434
- each(refs, ref => {
16435
- const controllers = ref.current;
16436
 
16437
- if (controllers.length) {
16438
- const queues = controllers.map(ctrl => {
16439
- const q = ctrl.queue;
16440
- ctrl.queue = [];
16441
- return q;
16442
- });
16443
- p = p.then(() => {
16444
- each(controllers, (ctrl, i) => each(queues[i] || [], update => ctrl.queue.push(update)));
16445
- return ref.start();
16446
- });
16447
  }
16448
- });
 
 
 
 
 
 
 
 
 
 
 
 
16449
  }
16450
- });
16451
- }
16452
 
16453
- const config = {
16454
- default: {
16455
- tension: 170,
16456
- friction: 26
16457
- },
16458
- gentle: {
16459
- tension: 120,
16460
- friction: 14
16461
- },
16462
- wobbly: {
16463
- tension: 180,
16464
- friction: 12
16465
- },
16466
- stiff: {
16467
- tension: 210,
16468
- friction: 20
16469
- },
16470
- slow: {
16471
- tension: 280,
16472
- friction: 60
16473
- },
16474
- molasses: {
16475
- tension: 280,
16476
- friction: 120
16477
- }
16478
- };
 
 
 
 
 
 
16479
 
16480
- const linear = t => t;
16481
 
16482
- const defaults = react_spring_core_esm_extends({}, config.default, {
16483
- mass: 1,
16484
- damping: 1,
16485
- easing: linear,
16486
- clamp: false
16487
- });
16488
 
16489
- class AnimationConfig {
16490
- constructor() {
16491
- this.tension = void 0;
16492
- this.friction = void 0;
16493
- this.frequency = void 0;
16494
- this.damping = void 0;
16495
- this.mass = void 0;
16496
- this.velocity = 0;
16497
- this.restVelocity = void 0;
16498
- this.precision = void 0;
16499
- this.progress = void 0;
16500
- this.duration = void 0;
16501
- this.easing = void 0;
16502
- this.clamp = void 0;
16503
- this.bounce = void 0;
16504
- this.decay = void 0;
16505
- this.round = void 0;
16506
- Object.assign(this, defaults);
16507
- }
16508
 
 
 
 
 
 
16509
  }
16510
- function mergeConfig(config, newConfig, defaultConfig) {
16511
- if (defaultConfig) {
16512
- defaultConfig = react_spring_core_esm_extends({}, defaultConfig);
16513
- sanitizeConfig(defaultConfig, newConfig);
16514
- newConfig = react_spring_core_esm_extends({}, defaultConfig, newConfig);
16515
- }
16516
 
16517
- sanitizeConfig(config, newConfig);
16518
- Object.assign(config, newConfig);
 
16519
 
16520
- for (const key in defaults) {
16521
- if (config[key] == null) {
16522
- config[key] = defaults[key];
16523
- }
16524
- }
16525
 
16526
- let {
16527
- mass,
16528
- frequency,
16529
- damping
16530
- } = config;
16531
 
16532
- if (!react_spring_shared_esm_is.und(frequency)) {
16533
- if (frequency < 0.01) frequency = 0.01;
16534
- if (damping < 0) damping = 0;
16535
- config.tension = Math.pow(2 * Math.PI / frequency, 2) * mass;
16536
- config.friction = 4 * Math.PI * damping * mass / frequency;
16537
- }
 
 
 
16538
 
16539
- return config;
16540
- }
16541
 
16542
- function sanitizeConfig(config, props) {
16543
- if (!react_spring_shared_esm_is.und(props.decay)) {
16544
- config.duration = undefined;
16545
- } else {
16546
- const isTensionConfig = !react_spring_shared_esm_is.und(props.tension) || !react_spring_shared_esm_is.und(props.friction);
16547
 
16548
- if (isTensionConfig || !react_spring_shared_esm_is.und(props.frequency) || !react_spring_shared_esm_is.und(props.damping) || !react_spring_shared_esm_is.und(props.mass)) {
16549
- config.duration = undefined;
16550
- config.decay = undefined;
16551
- }
16552
 
16553
- if (isTensionConfig) {
16554
- config.frequency = undefined;
16555
- }
16556
- }
16557
- }
16558
 
16559
- const emptyArray = [];
16560
- class Animation {
16561
- constructor() {
16562
- this.changed = false;
16563
- this.values = emptyArray;
16564
- this.toValues = null;
16565
- this.fromValues = emptyArray;
16566
- this.to = void 0;
16567
- this.from = void 0;
16568
- this.config = new AnimationConfig();
16569
- this.immediate = false;
 
16570
  }
16571
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16572
  }
 
 
16573
 
16574
- function scheduleProps(callId, {
16575
- key,
16576
- props,
16577
- defaultProps,
16578
- state,
16579
- actions
16580
- }) {
16581
- return new Promise((resolve, reject) => {
16582
- var _props$cancel;
16583
 
16584
- let delay;
16585
- let timeout;
16586
- let cancel = matchProp((_props$cancel = props.cancel) != null ? _props$cancel : defaultProps == null ? void 0 : defaultProps.cancel, key);
16587
 
16588
- if (cancel) {
16589
- onStart();
16590
- } else {
16591
- if (!react_spring_shared_esm_is.und(props.pause)) {
16592
- state.paused = matchProp(props.pause, key);
16593
- }
16594
 
16595
- let pause = defaultProps == null ? void 0 : defaultProps.pause;
16596
 
16597
- if (pause !== true) {
16598
- pause = state.paused || matchProp(pause, key);
16599
- }
16600
 
16601
- delay = callProp(props.delay || 0, key);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16602
 
16603
- if (pause) {
16604
- state.resumeQueue.add(onResume);
16605
- actions.pause();
16606
- } else {
16607
- actions.resume();
16608
- onResume();
16609
- }
16610
- }
 
 
 
 
 
16611
 
16612
- function onPause() {
16613
- state.resumeQueue.add(onResume);
16614
- state.timeouts.delete(timeout);
16615
- timeout.cancel();
16616
- delay = timeout.time - raf.now();
16617
- }
16618
 
16619
- function onResume() {
16620
- if (delay > 0) {
16621
- timeout = raf.setTimeout(onStart, delay);
16622
- state.pauseQueue.add(onPause);
16623
- state.timeouts.add(timeout);
16624
- } else {
16625
- onStart();
16626
- }
16627
- }
16628
 
16629
- function onStart() {
16630
- state.pauseQueue.delete(onPause);
16631
- state.timeouts.delete(timeout);
16632
 
16633
- if (callId <= (state.cancelId || 0)) {
16634
- cancel = true;
16635
- }
16636
 
16637
- try {
16638
- actions.start(react_spring_core_esm_extends({}, props, {
16639
- callId,
16640
- cancel
16641
- }), resolve);
16642
- } catch (err) {
16643
- reject(err);
16644
- }
16645
- }
16646
- });
16647
- }
16648
 
16649
- const getCombinedResult = (target, results) => results.length == 1 ? results[0] : results.some(result => result.cancelled) ? getCancelledResult(target.get()) : results.every(result => result.noop) ? getNoopResult(target.get()) : getFinishedResult(target.get(), results.every(result => result.finished));
16650
- const getNoopResult = value => ({
16651
- value,
16652
- noop: true,
16653
- finished: true,
16654
- cancelled: false
16655
- });
16656
- const getFinishedResult = (value, finished, cancelled = false) => ({
16657
- value,
16658
- finished,
16659
- cancelled
16660
- });
16661
- const getCancelledResult = value => ({
16662
- value,
16663
- cancelled: true,
16664
- finished: false
16665
- });
16666
 
16667
- function runAsync(to, props, state, target) {
16668
- const {
16669
- callId,
16670
- parentId,
16671
- onRest
16672
- } = props;
16673
- const {
16674
- asyncTo: prevTo,
16675
- promise: prevPromise
16676
- } = state;
16677
 
16678
- if (!parentId && to === prevTo && !props.reset) {
16679
- return prevPromise;
16680
- }
16681
 
16682
- return state.promise = (async () => {
16683
- state.asyncId = callId;
16684
- state.asyncTo = to;
16685
- const defaultProps = getDefaultProps(props, (value, key) => key === 'onRest' ? undefined : value);
16686
- let preventBail;
16687
- let bail;
16688
- const bailPromise = new Promise((resolve, reject) => (preventBail = resolve, bail = reject));
16689
 
16690
- const bailIfEnded = bailSignal => {
16691
- const bailResult = callId <= (state.cancelId || 0) && getCancelledResult(target) || callId !== state.asyncId && getFinishedResult(target, false);
 
 
 
 
 
 
 
 
 
16692
 
16693
- if (bailResult) {
16694
- bailSignal.result = bailResult;
16695
- bail(bailSignal);
16696
- throw bailSignal;
16697
- }
16698
- };
16699
 
16700
- const animate = (arg1, arg2) => {
16701
- const bailSignal = new BailSignal();
16702
- const skipAnimationSignal = new SkipAniamtionSignal();
16703
- return (async () => {
16704
- if (globals.skipAnimation) {
16705
- stopAsync(state);
16706
- skipAnimationSignal.result = getFinishedResult(target, false);
16707
- bail(skipAnimationSignal);
16708
- throw skipAnimationSignal;
16709
- }
16710
 
16711
- bailIfEnded(bailSignal);
16712
- const props = react_spring_shared_esm_is.obj(arg1) ? react_spring_core_esm_extends({}, arg1) : react_spring_core_esm_extends({}, arg2, {
16713
- to: arg1
16714
- });
16715
- props.parentId = callId;
16716
- eachProp(defaultProps, (value, key) => {
16717
- if (react_spring_shared_esm_is.und(props[key])) {
16718
- props[key] = value;
16719
- }
16720
- });
16721
- const result = await target.start(props);
16722
- bailIfEnded(bailSignal);
 
16723
 
16724
- if (state.paused) {
16725
- await new Promise(resume => {
16726
- state.resumeQueue.add(resume);
16727
- });
16728
- }
16729
 
16730
- return result;
16731
- })();
16732
- };
16733
 
16734
- let result;
16735
 
16736
- if (globals.skipAnimation) {
16737
- stopAsync(state);
16738
- return getFinishedResult(target, false);
16739
- }
16740
 
16741
- try {
16742
- let animating;
 
16743
 
16744
- if (react_spring_shared_esm_is.arr(to)) {
16745
- animating = (async queue => {
16746
- for (const props of queue) {
16747
- await animate(props);
16748
- }
16749
- })(to);
16750
- } else {
16751
- animating = Promise.resolve(to(animate, target.stop.bind(target)));
16752
- }
16753
 
16754
- await Promise.all([animating.then(preventBail), bailPromise]);
16755
- result = getFinishedResult(target.get(), true, false);
16756
- } catch (err) {
16757
- if (err instanceof BailSignal) {
16758
- result = err.result;
16759
- } else if (err instanceof SkipAniamtionSignal) {
16760
- result = err.result;
16761
- } else {
16762
- throw err;
16763
- }
16764
- } finally {
16765
- if (callId == state.asyncId) {
16766
- state.asyncId = parentId;
16767
- state.asyncTo = parentId ? prevTo : undefined;
16768
- state.promise = parentId ? prevPromise : undefined;
16769
- }
16770
- }
16771
 
16772
- if (react_spring_shared_esm_is.fun(onRest)) {
16773
- raf.batchedUpdates(() => {
16774
- onRest(result, target, target.item);
16775
- });
16776
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16777
 
16778
- return result;
16779
- })();
16780
- }
16781
- function stopAsync(state, cancelId) {
16782
- flush(state.timeouts, t => t.cancel());
16783
- state.pauseQueue.clear();
16784
- state.resumeQueue.clear();
16785
- state.asyncId = state.asyncTo = state.promise = undefined;
16786
- if (cancelId) state.cancelId = cancelId;
16787
- }
16788
- class BailSignal extends Error {
16789
- constructor() {
16790
- super('An async animation has been interrupted. You see this error because you ' + 'forgot to use `await` or `.catch(...)` on its returned promise.');
16791
- this.result = void 0;
16792
- }
 
 
 
 
 
 
 
 
 
16793
 
16794
- }
16795
- class SkipAniamtionSignal extends Error {
16796
- constructor() {
16797
- super('SkipAnimationSignal');
16798
- this.result = void 0;
16799
- }
16800
 
16801
- }
16802
 
16803
- const isFrameValue = value => value instanceof FrameValue;
16804
- let nextId$1 = 1;
16805
- class FrameValue extends FluidValue {
16806
- constructor(...args) {
16807
- super(...args);
16808
- this.id = nextId$1++;
16809
- this.key = void 0;
16810
- this._priority = 0;
16811
- }
16812
 
16813
- get priority() {
16814
- return this._priority;
16815
- }
16816
 
16817
- set priority(priority) {
16818
- if (this._priority != priority) {
16819
- this._priority = priority;
16820
 
16821
- this._onPriorityChange(priority);
 
 
 
 
 
 
 
 
 
 
16822
  }
16823
- }
 
 
 
16824
 
16825
- get() {
16826
- const node = getAnimated(this);
16827
- return node && node.getValue();
16828
- }
16829
 
16830
- to(...args) {
16831
- return globals.to(this, args);
16832
- }
 
 
 
16833
 
16834
- interpolate(...args) {
16835
- react_spring_shared_esm_deprecateInterpolate();
16836
- return globals.to(this, args);
16837
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16838
 
16839
- toJSON() {
16840
- return this.get();
16841
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16842
 
16843
- observerAdded(count) {
16844
- if (count == 1) this._attach();
16845
- }
 
 
 
 
16846
 
16847
- observerRemoved(count) {
16848
- if (count == 0) this._detach();
16849
- }
16850
 
16851
- _attach() {}
16852
 
16853
- _detach() {}
 
 
 
 
16854
 
16855
- _onChange(value, idle = false) {
16856
- callFluidObservers(this, {
16857
- type: 'change',
16858
- parent: this,
16859
- value,
16860
- idle
16861
- });
16862
- }
16863
 
16864
- _onPriorityChange(priority) {
16865
- if (!this.idle) {
16866
- frameLoop.sort(this);
16867
- }
 
 
 
 
 
16868
 
16869
- callFluidObservers(this, {
16870
- type: 'priority',
16871
- parent: this,
16872
- priority
16873
  });
16874
- }
16875
-
16876
  }
 
 
16877
 
16878
- const $P = Symbol.for('SpringPhase');
16879
- const HAS_ANIMATED = 1;
16880
- const IS_ANIMATING = 2;
16881
- const IS_PAUSED = 4;
16882
- const hasAnimated = target => (target[$P] & HAS_ANIMATED) > 0;
16883
- const isAnimating = target => (target[$P] & IS_ANIMATING) > 0;
16884
- const isPaused = target => (target[$P] & IS_PAUSED) > 0;
16885
- const setActiveBit = (target, active) => active ? target[$P] |= IS_ANIMATING | HAS_ANIMATED : target[$P] &= ~IS_ANIMATING;
16886
- const setPausedBit = (target, paused) => paused ? target[$P] |= IS_PAUSED : target[$P] &= ~IS_PAUSED;
16887
 
16888
- class SpringValue extends FrameValue {
16889
- constructor(arg1, arg2) {
16890
- super();
16891
- this.key = void 0;
16892
- this.animation = new Animation();
16893
- this.queue = void 0;
16894
- this.defaultProps = {};
16895
- this._state = {
16896
- paused: false,
16897
- pauseQueue: new Set(),
16898
- resumeQueue: new Set(),
16899
- timeouts: new Set()
16900
- };
16901
- this._pendingCalls = new Set();
16902
- this._lastCallId = 0;
16903
- this._lastToId = 0;
16904
- this._memoizedDuration = 0;
16905
 
16906
- if (!react_spring_shared_esm_is.und(arg1) || !react_spring_shared_esm_is.und(arg2)) {
16907
- const props = react_spring_shared_esm_is.obj(arg1) ? react_spring_core_esm_extends({}, arg1) : react_spring_core_esm_extends({}, arg2, {
16908
- from: arg1
16909
- });
16910
 
16911
- if (react_spring_shared_esm_is.und(props.default)) {
16912
- props.default = true;
16913
- }
16914
 
16915
- this.start(props);
16916
- }
16917
- }
16918
 
16919
- get idle() {
16920
- return !(isAnimating(this) || this._state.asyncTo) || isPaused(this);
16921
- }
16922
 
16923
- get goal() {
16924
- return getFluidValue(this.animation.to);
16925
- }
16926
 
16927
- get velocity() {
16928
- const node = getAnimated(this);
16929
- return node instanceof AnimatedValue ? node.lastVelocity || 0 : node.getPayload().map(node => node.lastVelocity || 0);
16930
- }
16931
 
16932
- get hasAnimated() {
16933
- return hasAnimated(this);
16934
- }
16935
 
16936
- get isAnimating() {
16937
- return isAnimating(this);
16938
- }
 
 
 
 
 
 
 
 
16939
 
16940
- get isPaused() {
16941
- return isPaused(this);
16942
- }
16943
 
16944
- advance(dt) {
16945
- let idle = true;
16946
- let changed = false;
16947
- const anim = this.animation;
16948
- let {
16949
- config,
16950
- toValues
16951
- } = anim;
16952
- const payload = getPayload(anim.to);
16953
 
16954
- if (!payload && hasFluidValue(anim.to)) {
16955
- toValues = react_spring_shared_esm_toArray(getFluidValue(anim.to));
16956
- }
16957
 
16958
- anim.values.forEach((node, i) => {
16959
- if (node.done) return;
16960
- const to = node.constructor == AnimatedString ? 1 : payload ? payload[i].lastPosition : toValues[i];
16961
- let finished = anim.immediate;
16962
- let position = to;
16963
 
16964
- if (!finished) {
16965
- position = node.lastPosition;
 
16966
 
16967
- if (config.tension <= 0) {
16968
- node.done = true;
16969
- return;
16970
- }
16971
 
16972
- let elapsed = node.elapsedTime += dt;
16973
- const from = anim.fromValues[i];
16974
- const v0 = node.v0 != null ? node.v0 : node.v0 = react_spring_shared_esm_is.arr(config.velocity) ? config.velocity[i] : config.velocity;
16975
- let velocity;
 
 
 
 
 
 
 
 
16976
 
16977
- if (!react_spring_shared_esm_is.und(config.duration)) {
16978
- let p = 1;
16979
 
16980
- if (config.duration > 0) {
16981
- if (this._memoizedDuration !== config.duration) {
16982
- this._memoizedDuration = config.duration;
16983
 
16984
- if (node.durationProgress > 0) {
16985
- node.elapsedTime = config.duration * node.durationProgress;
16986
- elapsed = node.elapsedTime += dt;
16987
- }
16988
- }
16989
 
16990
- p = (config.progress || 0) + elapsed / this._memoizedDuration;
16991
- p = p > 1 ? 1 : p < 0 ? 0 : p;
16992
- node.durationProgress = p;
16993
- }
16994
 
16995
- position = from + config.easing(p) * (to - from);
16996
- velocity = (position - node.lastPosition) / dt;
16997
- finished = p == 1;
16998
- } else if (config.decay) {
16999
- const decay = config.decay === true ? 0.998 : config.decay;
17000
- const e = Math.exp(-(1 - decay) * elapsed);
17001
- position = from + v0 / (1 - decay) * (1 - e);
17002
- finished = Math.abs(node.lastPosition - position) < 0.1;
17003
- velocity = v0 * e;
17004
- } else {
17005
- velocity = node.lastVelocity == null ? v0 : node.lastVelocity;
17006
- const precision = config.precision || (from == to ? 0.005 : Math.min(1, Math.abs(to - from) * 0.001));
17007
- const restVelocity = config.restVelocity || precision / 10;
17008
- const bounceFactor = config.clamp ? 0 : config.bounce;
17009
- const canBounce = !react_spring_shared_esm_is.und(bounceFactor);
17010
- const isGrowing = from == to ? node.v0 > 0 : from < to;
17011
- let isMoving;
17012
- let isBouncing = false;
17013
- const step = 1;
17014
- const numSteps = Math.ceil(dt / step);
17015
 
17016
- for (let n = 0; n < numSteps; ++n) {
17017
- isMoving = Math.abs(velocity) > restVelocity;
17018
 
17019
- if (!isMoving) {
17020
- finished = Math.abs(to - position) <= precision;
 
 
 
 
 
17021
 
17022
- if (finished) {
17023
- break;
17024
- }
17025
- }
 
 
 
 
 
 
 
 
 
17026
 
17027
- if (canBounce) {
17028
- isBouncing = position == to || position > to == isGrowing;
17029
 
17030
- if (isBouncing) {
17031
- velocity = -velocity * bounceFactor;
17032
- position = to;
17033
- }
17034
- }
17035
 
17036
- const springForce = -config.tension * 0.000001 * (position - to);
17037
- const dampingForce = -config.friction * 0.001 * velocity;
17038
- const acceleration = (springForce + dampingForce) / config.mass;
17039
- velocity = velocity + acceleration * step;
17040
- position = position + velocity * step;
17041
- }
17042
- }
17043
 
17044
- node.lastVelocity = velocity;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17045
 
17046
- if (Number.isNaN(position)) {
17047
- console.warn(`Got NaN while animating:`, this);
17048
- finished = true;
17049
- }
17050
- }
17051
 
17052
- if (payload && !payload[i].done) {
17053
- finished = false;
17054
- }
17055
 
17056
- if (finished) {
17057
- node.done = true;
17058
- } else {
17059
- idle = false;
17060
- }
17061
 
17062
- if (node.setValue(position, config.round)) {
17063
- changed = true;
17064
- }
17065
- });
17066
- const node = getAnimated(this);
17067
- const currVal = node.getValue();
17068
 
17069
- if (idle) {
17070
- const finalVal = getFluidValue(anim.to);
17071
 
17072
- if ((currVal !== finalVal || changed) && !config.decay) {
17073
- node.setValue(finalVal);
17074
 
17075
- this._onChange(finalVal);
17076
- } else if (changed && config.decay) {
17077
- this._onChange(currVal);
17078
- }
17079
 
17080
- this._stop();
17081
- } else if (changed) {
17082
- this._onChange(currVal);
 
 
 
17083
  }
17084
- }
 
 
 
 
 
 
 
 
17085
 
17086
- set(value) {
17087
- raf.batchedUpdates(() => {
17088
- this._stop();
17089
 
17090
- this._focus(value);
 
 
17091
 
17092
- this._set(value);
17093
- });
17094
- return this;
17095
- }
17096
 
17097
- pause() {
17098
- this._update({
17099
- pause: true
17100
- });
17101
  }
17102
 
17103
- resume() {
17104
- this._update({
17105
- pause: false
17106
- });
17107
- }
17108
 
17109
- finish() {
17110
- if (isAnimating(this)) {
17111
- const {
17112
- to,
17113
- config
17114
- } = this.animation;
17115
- raf.batchedUpdates(() => {
17116
- this._onStart();
 
 
 
 
 
 
17117
 
17118
- if (!config.decay) {
17119
- this._set(to, false);
17120
- }
 
 
 
 
 
17121
 
17122
- this._stop();
17123
- });
17124
- }
 
 
 
17125
 
17126
- return this;
17127
- }
 
 
 
 
 
 
 
 
 
 
 
 
17128
 
17129
- update(props) {
17130
- const queue = this.queue || (this.queue = []);
17131
- queue.push(props);
17132
- return this;
17133
- }
 
17134
 
17135
- start(to, arg2) {
17136
- let queue;
 
 
17137
 
17138
- if (!react_spring_shared_esm_is.und(to)) {
17139
- queue = [react_spring_shared_esm_is.obj(to) ? to : react_spring_core_esm_extends({}, arg2, {
17140
- to
17141
- })];
17142
- } else {
17143
- queue = this.queue || [];
17144
- this.queue = [];
17145
  }
17146
 
17147
- return Promise.all(queue.map(props => this._update(props))).then(results => getCombinedResult(this, results));
17148
- }
17149
-
17150
- stop(cancel) {
17151
  const {
17152
- to
17153
- } = this.animation;
17154
-
17155
- this._focus(this.get());
17156
 
17157
- stopAsync(this._state, cancel && this._lastCallId);
17158
- raf.batchedUpdates(() => this._stop(to, cancel));
17159
- return this;
17160
- }
17161
 
17162
- reset() {
17163
- this._update({
17164
- reset: true
17165
- });
17166
- }
17167
 
17168
- eventObserved(event) {
17169
- if (event.type == 'change') {
17170
- this._start();
17171
- } else if (event.type == 'priority') {
17172
- this.priority = event.priority + 1;
17173
- }
17174
- }
17175
 
17176
- _prepareNode(props) {
17177
- const key = this.key || '';
17178
- let {
17179
- to,
17180
- from
17181
- } = props;
17182
- to = react_spring_shared_esm_is.obj(to) ? to[key] : to;
17183
 
17184
- if (to == null || isAsyncTo(to)) {
17185
- to = undefined;
17186
- }
 
 
17187
 
17188
- from = react_spring_shared_esm_is.obj(from) ? from[key] : from;
 
 
 
17189
 
17190
- if (from == null) {
17191
- from = undefined;
17192
- }
 
 
 
 
 
 
17193
 
17194
- const range = {
17195
- to,
17196
- from
17197
- };
17198
 
17199
- if (!hasAnimated(this)) {
17200
- if (props.reverse) [to, from] = [from, to];
17201
- from = getFluidValue(from);
17202
 
17203
- if (!react_spring_shared_esm_is.und(from)) {
17204
- this._set(from);
17205
- } else if (!getAnimated(this)) {
17206
- this._set(to);
17207
- }
17208
- }
17209
 
17210
- return range;
17211
- }
17212
 
17213
- _update(_ref, isLoop) {
17214
- let props = react_spring_core_esm_extends({}, _ref);
17215
 
17216
- const {
17217
- key,
17218
- defaultProps
17219
- } = this;
17220
- if (props.default) Object.assign(defaultProps, getDefaultProps(props, (value, prop) => /^on/.test(prop) ? resolveProp(value, key) : value));
17221
- mergeActiveFn(this, props, 'onProps');
17222
- sendEvent(this, 'onProps', props, this);
17223
 
17224
- const range = this._prepareNode(props);
 
 
17225
 
17226
- if (Object.isFrozen(this)) {
17227
- throw Error('Cannot animate a `SpringValue` object that is frozen. ' + 'Did you forget to pass your component to `animated(...)` before animating its props?');
17228
- }
17229
 
17230
- const state = this._state;
17231
- return scheduleProps(++this._lastCallId, {
17232
- key,
17233
- props,
17234
- defaultProps,
17235
- state,
17236
- actions: {
17237
- pause: () => {
17238
- if (!isPaused(this)) {
17239
- setPausedBit(this, true);
17240
- flushCalls(state.pauseQueue);
17241
- sendEvent(this, 'onPause', getFinishedResult(this, checkFinished(this, this.animation.to)), this);
17242
- }
17243
- },
17244
- resume: () => {
17245
- if (isPaused(this)) {
17246
- setPausedBit(this, false);
17247
 
17248
- if (isAnimating(this)) {
17249
- this._resume();
17250
- }
 
 
 
17251
 
17252
- flushCalls(state.resumeQueue);
17253
- sendEvent(this, 'onResume', getFinishedResult(this, checkFinished(this, this.animation.to)), this);
17254
- }
17255
- },
17256
- start: this._merge.bind(this, range)
17257
- }
17258
- }).then(result => {
17259
- if (props.loop && result.finished && !(isLoop && result.noop)) {
17260
- const nextProps = createLoopUpdate(props);
 
 
 
 
 
17261
 
17262
- if (nextProps) {
17263
- return this._update(nextProps, true);
17264
- }
17265
- }
17266
 
17267
- return result;
17268
- });
17269
- }
17270
 
17271
- _merge(range, props, resolve) {
17272
- if (props.cancel) {
17273
- this.stop(true);
17274
- return resolve(getCancelledResult(this));
 
 
 
 
 
 
 
 
 
 
17275
  }
 
17276
 
17277
- const hasToProp = !react_spring_shared_esm_is.und(range.to);
17278
- const hasFromProp = !react_spring_shared_esm_is.und(range.from);
17279
-
17280
- if (hasToProp || hasFromProp) {
17281
- if (props.callId > this._lastToId) {
17282
- this._lastToId = props.callId;
17283
- } else {
17284
- return resolve(getCancelledResult(this));
 
 
 
 
 
 
17285
  }
17286
- }
17287
-
17288
- const {
17289
- key,
17290
- defaultProps,
17291
- animation: anim
17292
- } = this;
17293
- const {
17294
- to: prevTo,
17295
- from: prevFrom
17296
- } = anim;
17297
- let {
17298
- to = prevTo,
17299
- from = prevFrom
17300
- } = range;
17301
 
17302
- if (hasFromProp && !hasToProp && (!props.default || react_spring_shared_esm_is.und(to))) {
17303
- to = from;
17304
- }
 
 
 
 
 
 
 
17305
 
17306
- if (props.reverse) [to, from] = [from, to];
17307
- const hasFromChanged = !isEqual(from, prevFrom);
17308
 
17309
- if (hasFromChanged) {
17310
- anim.from = from;
17311
- }
17312
 
17313
- from = getFluidValue(from);
17314
- const hasToChanged = !isEqual(to, prevTo);
17315
 
17316
- if (hasToChanged) {
17317
- this._focus(to);
17318
- }
 
 
 
 
 
 
 
 
 
 
 
17319
 
17320
- const hasAsyncTo = isAsyncTo(props.to);
17321
- const {
17322
- config
17323
- } = anim;
17324
- const {
17325
- decay,
17326
- velocity
17327
- } = config;
17328
 
17329
- if (hasToProp || hasFromProp) {
17330
- config.velocity = 0;
17331
- }
17332
 
17333
- if (props.config && !hasAsyncTo) {
17334
- mergeConfig(config, callProp(props.config, key), props.config !== defaultProps.config ? callProp(defaultProps.config, key) : void 0);
17335
- }
17336
 
17337
- let node = getAnimated(this);
 
 
17338
 
17339
- if (!node || react_spring_shared_esm_is.und(to)) {
17340
- return resolve(getFinishedResult(this, true));
 
17341
  }
17342
 
17343
- const reset = react_spring_shared_esm_is.und(props.reset) ? hasFromProp && !props.default : !react_spring_shared_esm_is.und(from) && matchProp(props.reset, key);
17344
- const value = reset ? from : this.get();
17345
- const goal = computeGoal(to);
17346
- const isAnimatable = react_spring_shared_esm_is.num(goal) || react_spring_shared_esm_is.arr(goal) || isAnimatedString(goal);
17347
- const immediate = !hasAsyncTo && (!isAnimatable || matchProp(defaultProps.immediate || props.immediate, key));
17348
-
17349
- if (hasToChanged) {
17350
- const nodeType = getAnimatedType(to);
17351
 
17352
- if (nodeType !== node.constructor) {
17353
- if (immediate) {
17354
- node = this._set(goal);
17355
- } else throw Error(`Cannot animate between ${node.constructor.name} and ${nodeType.name}, as the "to" prop suggests`);
17356
  }
17357
- }
 
 
 
 
 
 
 
17358
 
17359
- const goalType = node.constructor;
17360
- let started = hasFluidValue(to);
17361
- let finished = false;
17362
 
17363
- if (!started) {
17364
- const hasValueChanged = reset || !hasAnimated(this) && hasFromChanged;
17365
 
17366
- if (hasToChanged || hasValueChanged) {
17367
- finished = isEqual(computeGoal(value), goal);
17368
- started = !finished;
17369
  }
17370
 
17371
- if (!isEqual(anim.immediate, immediate) && !immediate || !isEqual(config.decay, decay) || !isEqual(config.velocity, velocity)) {
17372
- started = true;
17373
  }
17374
- }
17375
-
17376
- if (finished && isAnimating(this)) {
17377
- if (anim.changed && !reset) {
17378
- started = true;
17379
- } else if (!started) {
17380
- this._stop(prevTo);
17381
- }
17382
- }
17383
 
17384
- if (!hasAsyncTo) {
17385
- if (started || hasFluidValue(prevTo)) {
17386
- anim.values = node.getPayload();
17387
- anim.toValues = hasFluidValue(to) ? null : goalType == AnimatedString ? [1] : react_spring_shared_esm_toArray(goal);
17388
  }
17389
 
17390
- if (anim.immediate != immediate) {
17391
- anim.immediate = immediate;
 
17392
 
17393
- if (!immediate && !reset) {
17394
- this._set(prevTo);
17395
- }
 
 
17396
  }
 
17397
 
17398
- if (started) {
17399
- const {
17400
- onRest
17401
- } = anim;
17402
- react_spring_shared_esm_each(ACTIVE_EVENTS, type => mergeActiveFn(this, props, type));
17403
- const result = getFinishedResult(this, checkFinished(this, prevTo));
17404
- flushCalls(this._pendingCalls, result);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17405
 
17406
- this._pendingCalls.add(resolve);
 
 
17407
 
17408
- if (anim.changed) raf.batchedUpdates(() => {
17409
- anim.changed = !reset;
17410
- onRest == null ? void 0 : onRest(result, this);
17411
 
17412
- if (reset) {
17413
- callProp(defaultProps.onRest, result);
17414
- } else {
17415
- anim.onStart == null ? void 0 : anim.onStart(result, this);
17416
- }
17417
- });
17418
- }
17419
- }
17420
 
17421
- if (reset) {
17422
- this._set(value);
17423
- }
17424
 
17425
- if (hasAsyncTo) {
17426
- resolve(runAsync(props.to, props, this._state, this));
17427
- } else if (started) {
17428
- this._start();
17429
- } else if (isAnimating(this) && !hasToChanged) {
17430
- this._pendingCalls.add(resolve);
17431
- } else {
17432
- resolve(getNoopResult(value));
17433
- }
17434
- }
17435
 
17436
- _focus(value) {
17437
- const anim = this.animation;
 
17438
 
17439
- if (value !== anim.to) {
17440
- if (getFluidObservers(this)) {
17441
- this._detach();
17442
- }
17443
 
17444
- anim.to = value;
17445
 
17446
- if (getFluidObservers(this)) {
17447
- this._attach();
17448
- }
17449
- }
17450
- }
 
 
 
 
 
17451
 
17452
- _attach() {
17453
- let priority = 0;
17454
- const {
17455
- to
17456
- } = this.animation;
17457
 
17458
- if (hasFluidValue(to)) {
17459
- addFluidObserver(to, this);
 
17460
 
17461
- if (isFrameValue(to)) {
17462
- priority = to.priority + 1;
17463
- }
17464
- }
17465
 
17466
- this.priority = priority;
17467
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17468
 
17469
- _detach() {
17470
- const {
17471
- to
17472
- } = this.animation;
17473
 
17474
- if (hasFluidValue(to)) {
17475
- removeFluidObserver(to, this);
17476
- }
17477
  }
17478
 
17479
- _set(arg, idle = true) {
17480
- const value = getFluidValue(arg);
 
 
 
17481
 
17482
- if (!react_spring_shared_esm_is.und(value)) {
17483
- const oldNode = getAnimated(this);
17484
 
17485
- if (!oldNode || !isEqual(value, oldNode.getValue())) {
17486
- const nodeType = getAnimatedType(value);
 
17487
 
17488
- if (!oldNode || oldNode.constructor != nodeType) {
17489
- setAnimated(this, nodeType.create(value));
17490
- } else {
17491
- oldNode.setValue(value);
17492
- }
17493
 
17494
- if (oldNode) {
17495
- raf.batchedUpdates(() => {
17496
- this._onChange(value, idle);
17497
- });
17498
- }
17499
  }
17500
  }
17501
 
17502
- return getAnimated(this);
17503
- }
17504
-
17505
- _onStart() {
17506
- const anim = this.animation;
17507
-
17508
- if (!anim.changed) {
17509
- anim.changed = true;
17510
- sendEvent(this, 'onStart', getFinishedResult(this, checkFinished(this, anim.to)), this);
17511
- }
17512
  }
17513
 
17514
- _onChange(value, idle) {
17515
- if (!idle) {
17516
- this._onStart();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17517
 
17518
- callProp(this.animation.onChange, value, this);
 
17519
  }
17520
 
17521
- callProp(this.defaultProps.onChange, value, this);
17522
-
17523
- super._onChange(value, idle);
17524
- }
17525
-
17526
- _start() {
17527
- const anim = this.animation;
17528
- getAnimated(this).reset(getFluidValue(anim.to));
17529
 
17530
- if (!anim.immediate) {
17531
- anim.fromValues = anim.values.map(node => node.lastPosition);
 
 
 
 
 
17532
  }
17533
 
17534
- if (!isAnimating(this)) {
17535
- setActiveBit(this, true);
 
 
17536
 
17537
- if (!isPaused(this)) {
17538
- this._resume();
17539
  }
17540
  }
17541
- }
 
 
 
 
 
 
 
 
 
 
17542
 
17543
- _resume() {
17544
- if (globals.skipAnimation) {
17545
- this.finish();
17546
- } else {
17547
- frameLoop.start(this);
17548
  }
17549
- }
17550
 
17551
- _stop(goal, cancel) {
17552
- if (isAnimating(this)) {
17553
- setActiveBit(this, false);
17554
- const anim = this.animation;
17555
- react_spring_shared_esm_each(anim.values, node => {
17556
- node.done = true;
17557
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17558
 
17559
- if (anim.toValues) {
17560
- anim.onChange = anim.onPause = anim.onResume = undefined;
17561
- }
 
 
 
17562
 
17563
- callFluidObservers(this, {
17564
- type: 'idle',
17565
- parent: this
17566
- });
17567
- const result = cancel ? getCancelledResult(this.get()) : getFinishedResult(this.get(), checkFinished(this, goal != null ? goal : anim.to));
17568
- flushCalls(this._pendingCalls, result);
 
 
17569
 
17570
- if (anim.changed) {
17571
- anim.changed = false;
17572
- sendEvent(this, 'onRest', result, this);
17573
- }
17574
- }
17575
- }
17576
 
17577
- }
 
 
 
 
 
17578
 
17579
- function checkFinished(target, to) {
17580
- const goal = computeGoal(to);
17581
- const value = computeGoal(target.get());
17582
- return isEqual(value, goal);
17583
- }
17584
 
17585
- function createLoopUpdate(props, loop = props.loop, to = props.to) {
17586
- let loopRet = callProp(loop);
 
17587
 
17588
- if (loopRet) {
17589
- const overrides = loopRet !== true && inferTo(loopRet);
17590
- const reverse = (overrides || props).reverse;
17591
- const reset = !overrides || overrides.reset;
17592
- return createUpdate(react_spring_core_esm_extends({}, props, {
17593
- loop,
17594
- default: false,
17595
- pause: undefined,
17596
- to: !reverse || isAsyncTo(to) ? to : undefined,
17597
- from: reset ? props.from : undefined,
17598
- reset
17599
- }, overrides));
17600
- }
17601
- }
17602
- function createUpdate(props) {
17603
- const {
17604
- to,
17605
- from
17606
- } = props = inferTo(props);
17607
- const keys = new Set();
17608
- if (react_spring_shared_esm_is.obj(to)) findDefined(to, keys);
17609
- if (react_spring_shared_esm_is.obj(from)) findDefined(from, keys);
17610
- props.keys = keys.size ? Array.from(keys) : null;
17611
- return props;
17612
- }
17613
- function declareUpdate(props) {
17614
- const update = createUpdate(props);
17615
 
17616
- if (react_spring_shared_esm_is.und(update.default)) {
17617
- update.default = getDefaultProps(update);
17618
- }
17619
 
17620
- return update;
17621
- }
 
 
17622
 
17623
- function findDefined(values, keys) {
17624
- eachProp(values, (value, key) => value != null && keys.add(key));
17625
- }
17626
 
17627
- const ACTIVE_EVENTS = ['onStart', 'onRest', 'onChange', 'onPause', 'onResume'];
 
 
 
 
17628
 
17629
- function mergeActiveFn(target, props, type) {
17630
- target.animation[type] = props[type] !== getDefaultProp(props, type) ? resolveProp(props[type], target.key) : undefined;
17631
- }
 
17632
 
17633
- function sendEvent(target, type, ...args) {
17634
- var _target$animation$typ, _target$animation, _target$defaultProps$, _target$defaultProps;
 
 
 
 
 
 
 
17635
 
17636
- (_target$animation$typ = (_target$animation = target.animation)[type]) == null ? void 0 : _target$animation$typ.call(_target$animation, ...args);
17637
- (_target$defaultProps$ = (_target$defaultProps = target.defaultProps)[type]) == null ? void 0 : _target$defaultProps$.call(_target$defaultProps, ...args);
17638
- }
 
 
 
 
 
 
 
17639
 
17640
- const BATCHED_EVENTS = ['onStart', 'onChange', 'onRest'];
17641
- let nextId = 1;
17642
- class Controller {
17643
- constructor(props, flush) {
17644
- this.id = nextId++;
17645
- this.springs = {};
17646
- this.queue = [];
17647
- this.ref = void 0;
17648
- this._flush = void 0;
17649
- this._initialProps = void 0;
17650
- this._lastAsyncId = 0;
17651
- this._active = new Set();
17652
- this._changed = new Set();
17653
- this._started = false;
17654
- this._item = void 0;
17655
- this._state = {
17656
- paused: false,
17657
- pauseQueue: new Set(),
17658
- resumeQueue: new Set(),
17659
- timeouts: new Set()
17660
- };
17661
- this._events = {
17662
- onStart: new Map(),
17663
- onChange: new Map(),
17664
- onRest: new Map()
17665
  };
17666
- this._onFrame = this._onFrame.bind(this);
 
 
 
 
 
 
 
 
17667
 
17668
- if (flush) {
17669
- this._flush = flush;
17670
- }
17671
 
17672
- if (props) {
17673
- this.start(react_spring_core_esm_extends({
17674
- default: true
17675
- }, props));
17676
- }
17677
- }
17678
 
17679
- get idle() {
17680
- return !this._state.asyncTo && Object.values(this.springs).every(spring => spring.idle);
17681
- }
17682
 
17683
- get item() {
17684
- return this._item;
17685
- }
17686
 
17687
- set item(item) {
17688
- this._item = item;
17689
- }
17690
 
17691
- get() {
17692
- const values = {};
17693
- this.each((spring, key) => values[key] = spring.get());
17694
- return values;
17695
- }
17696
 
17697
- set(values) {
17698
- for (const key in values) {
17699
- const value = values[key];
17700
 
17701
- if (!react_spring_shared_esm_is.und(value)) {
17702
- this.springs[key].set(value);
 
 
 
 
 
 
 
 
 
 
 
 
17703
  }
17704
- }
17705
- }
17706
-
17707
- update(props) {
17708
- if (props) {
17709
- this.queue.push(createUpdate(props));
17710
- }
17711
-
17712
- return this;
17713
- }
17714
 
17715
- start(props) {
17716
- let {
17717
- queue
17718
- } = this;
17719
 
17720
- if (props) {
17721
- queue = react_spring_shared_esm_toArray(props).map(createUpdate);
17722
- } else {
17723
- this.queue = [];
17724
- }
17725
 
17726
- if (this._flush) {
17727
- return this._flush(this, queue);
17728
- }
17729
 
17730
- prepareKeys(this, queue);
17731
- return flushUpdateQueue(this, queue);
17732
- }
17733
 
17734
- stop(arg, keys) {
17735
- if (arg !== !!arg) {
17736
- keys = arg;
17737
- }
17738
 
17739
- if (keys) {
17740
- const springs = this.springs;
17741
- react_spring_shared_esm_each(react_spring_shared_esm_toArray(keys), key => springs[key].stop(!!arg));
17742
- } else {
17743
- stopAsync(this._state, this._lastAsyncId);
17744
- this.each(spring => spring.stop(!!arg));
17745
  }
17746
 
17747
- return this;
17748
- }
 
 
 
 
 
 
17749
 
17750
- pause(keys) {
17751
- if (react_spring_shared_esm_is.und(keys)) {
17752
- this.start({
17753
- pause: true
17754
- });
17755
- } else {
17756
- const springs = this.springs;
17757
- react_spring_shared_esm_each(react_spring_shared_esm_toArray(keys), key => springs[key].pause());
17758
- }
17759
 
17760
- return this;
17761
- }
17762
 
17763
- resume(keys) {
17764
- if (react_spring_shared_esm_is.und(keys)) {
17765
- this.start({
17766
- pause: false
17767
- });
17768
- } else {
17769
- const springs = this.springs;
17770
- react_spring_shared_esm_each(react_spring_shared_esm_toArray(keys), key => springs[key].resume());
17771
- }
17772
 
17773
- return this;
17774
- }
 
17775
 
17776
- each(iterator) {
17777
- eachProp(this.springs, iterator);
17778
- }
17779
 
17780
- _onFrame() {
17781
- const {
17782
- onStart,
17783
- onChange,
17784
- onRest
17785
- } = this._events;
17786
- const active = this._active.size > 0;
17787
- const changed = this._changed.size > 0;
17788
 
17789
- if (active && !this._started || changed && !this._started) {
17790
- this._started = true;
17791
- flush(onStart, ([onStart, result]) => {
17792
- result.value = this.get();
17793
- onStart(result, this, this._item);
17794
- });
17795
- }
17796
 
17797
- const idle = !active && this._started;
17798
- const values = changed || idle && onRest.size ? this.get() : null;
17799
 
17800
- if (changed && onChange.size) {
17801
- flush(onChange, ([onChange, result]) => {
17802
- result.value = values;
17803
- onChange(result, this, this._item);
17804
- });
17805
- }
17806
 
17807
- if (idle) {
17808
- this._started = false;
17809
- flush(onRest, ([onRest, result]) => {
17810
- result.value = values;
17811
- onRest(result, this, this._item);
17812
- });
17813
- }
17814
- }
17815
 
17816
- eventObserved(event) {
17817
- if (event.type == 'change') {
17818
- this._changed.add(event.parent);
17819
 
17820
- if (!event.idle) {
17821
- this._active.add(event.parent);
17822
- }
17823
- } else if (event.type == 'idle') {
17824
- this._active.delete(event.parent);
17825
- } else return;
17826
 
17827
- raf.onFrame(this._onFrame);
17828
- }
17829
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17830
  }
17831
- function flushUpdateQueue(ctrl, queue) {
17832
- return Promise.all(queue.map(props => flushUpdate(ctrl, props))).then(results => getCombinedResult(ctrl, results));
 
 
 
 
 
 
 
 
17833
  }
17834
- async function flushUpdate(ctrl, props, isLoop) {
17835
- const {
17836
- keys,
17837
- to,
17838
- from,
17839
- loop,
17840
- onRest,
17841
- onResolve
17842
- } = props;
17843
- const defaults = react_spring_shared_esm_is.obj(props.default) && props.default;
17844
 
17845
- if (loop) {
17846
- props.loop = false;
17847
- }
17848
 
17849
- if (to === false) props.to = null;
17850
- if (from === false) props.from = null;
17851
- const asyncTo = react_spring_shared_esm_is.arr(to) || react_spring_shared_esm_is.fun(to) ? to : undefined;
17852
 
17853
- if (asyncTo) {
17854
- props.to = undefined;
17855
- props.onRest = undefined;
17856
 
17857
- if (defaults) {
17858
- defaults.onRest = undefined;
17859
- }
17860
- } else {
17861
- react_spring_shared_esm_each(BATCHED_EVENTS, key => {
17862
- const handler = props[key];
17863
 
17864
- if (react_spring_shared_esm_is.fun(handler)) {
17865
- const queue = ctrl['_events'][key];
 
17866
 
17867
- props[key] = ({
17868
- finished,
17869
- cancelled
17870
- }) => {
17871
- const result = queue.get(handler);
17872
 
17873
- if (result) {
17874
- if (!finished) result.finished = false;
17875
- if (cancelled) result.cancelled = true;
17876
- } else {
17877
- queue.set(handler, {
17878
- value: null,
17879
- finished: finished || false,
17880
- cancelled: cancelled || false
17881
- });
17882
- }
17883
- };
17884
 
17885
- if (defaults) {
17886
- defaults[key] = props[key];
17887
- }
17888
- }
17889
- });
17890
- }
17891
 
17892
- const state = ctrl['_state'];
17893
 
17894
- if (props.pause === !state.paused) {
17895
- state.paused = props.pause;
17896
- flushCalls(props.pause ? state.pauseQueue : state.resumeQueue);
17897
- } else if (state.paused) {
17898
- props.pause = true;
17899
- }
17900
 
17901
- const promises = (keys || Object.keys(ctrl.springs)).map(key => ctrl.springs[key].start(props));
17902
- const cancel = props.cancel === true || getDefaultProp(props, 'cancel') === true;
 
17903
 
17904
- if (asyncTo || cancel && state.asyncId) {
17905
- promises.push(scheduleProps(++ctrl['_lastAsyncId'], {
17906
- props,
17907
- state,
17908
- actions: {
17909
- pause: noop,
17910
- resume: noop,
17911
 
17912
- start(props, resolve) {
17913
- if (cancel) {
17914
- stopAsync(state, ctrl['_lastAsyncId']);
17915
- resolve(getCancelledResult(ctrl));
17916
- } else {
17917
- props.onRest = onRest;
17918
- resolve(runAsync(asyncTo, props, state, ctrl));
17919
- }
17920
- }
17921
 
17922
- }
17923
- }));
17924
- }
 
 
 
 
 
 
 
 
 
17925
 
17926
- if (state.paused) {
17927
- await new Promise(resume => {
17928
- state.resumeQueue.add(resume);
17929
- });
17930
- }
 
 
 
 
 
17931
 
17932
- const result = getCombinedResult(ctrl, await Promise.all(promises));
 
 
 
17933
 
17934
- if (loop && result.finished && !(isLoop && result.noop)) {
17935
- const nextProps = createLoopUpdate(props, loop, to);
 
 
17936
 
17937
- if (nextProps) {
17938
- prepareKeys(ctrl, [nextProps]);
17939
- return flushUpdate(ctrl, nextProps, true);
17940
- }
17941
- }
17942
 
17943
- if (onResolve) {
17944
- raf.batchedUpdates(() => onResolve(result, ctrl, ctrl.item));
17945
- }
 
 
17946
 
17947
- return result;
17948
- }
17949
- function getSprings(ctrl, props) {
17950
- const springs = react_spring_core_esm_extends({}, ctrl.springs);
17951
 
17952
- if (props) {
17953
- react_spring_shared_esm_each(react_spring_shared_esm_toArray(props), props => {
17954
- if (react_spring_shared_esm_is.und(props.keys)) {
17955
- props = createUpdate(props);
17956
- }
17957
 
17958
- if (!react_spring_shared_esm_is.obj(props.to)) {
17959
- props = react_spring_core_esm_extends({}, props, {
17960
- to: undefined
17961
- });
17962
- }
17963
 
17964
- prepareSprings(springs, props, key => {
17965
- return createSpring(key);
17966
- });
17967
- });
17968
- }
 
17969
 
17970
- setSprings(ctrl, springs);
17971
- return springs;
17972
- }
17973
- function setSprings(ctrl, springs) {
17974
- eachProp(springs, (spring, key) => {
17975
- if (!ctrl.springs[key]) {
17976
- ctrl.springs[key] = spring;
17977
- addFluidObserver(spring, ctrl);
17978
  }
17979
  });
17980
  }
 
 
 
 
 
 
 
 
 
 
17981
 
17982
- function createSpring(key, observer) {
17983
- const spring = new SpringValue();
17984
- spring.key = key;
17985
 
17986
- if (observer) {
17987
- addFluidObserver(spring, observer);
17988
- }
 
 
 
 
17989
 
17990
- return spring;
17991
- }
 
 
 
17992
 
17993
- function prepareSprings(springs, props, create) {
17994
- if (props.keys) {
17995
- react_spring_shared_esm_each(props.keys, key => {
17996
- const spring = springs[key] || (springs[key] = create(key));
17997
- spring['_prepareNode'](props);
17998
- });
17999
- }
18000
- }
18001
 
18002
- function prepareKeys(ctrl, queue) {
18003
- react_spring_shared_esm_each(queue, props => {
18004
- prepareSprings(ctrl.springs, props, key => {
18005
- return createSpring(key, ctrl);
18006
- });
18007
- });
18008
- }
18009
 
18010
- function _objectWithoutPropertiesLoose(source, excluded) {
18011
- if (source == null) return {};
18012
- var target = {};
18013
- var sourceKeys = Object.keys(source);
18014
- var key, i;
18015
 
18016
- for (i = 0; i < sourceKeys.length; i++) {
18017
- key = sourceKeys[i];
18018
- if (excluded.indexOf(key) >= 0) continue;
18019
- target[key] = source[key];
18020
  }
18021
 
18022
- return target;
18023
- }
18024
-
18025
- const _excluded$3 = ["children"];
18026
- const SpringContext = _ref => {
18027
- let {
18028
- children
18029
- } = _ref,
18030
- props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
18031
-
18032
- const inherited = (0,external_React_.useContext)(ctx);
18033
- const pause = props.pause || !!inherited.pause,
18034
- immediate = props.immediate || !!inherited.immediate;
18035
- props = useMemoOne(() => ({
18036
- pause,
18037
- immediate
18038
- }), [pause, immediate]);
18039
- const {
18040
- Provider
18041
- } = ctx;
18042
- return external_React_.createElement(Provider, {
18043
- value: props
18044
- }, children);
18045
- };
18046
- const ctx = makeContext(SpringContext, {});
18047
- SpringContext.Provider = ctx.Provider;
18048
- SpringContext.Consumer = ctx.Consumer;
18049
 
18050
- function makeContext(target, init) {
18051
- Object.assign(target, external_React_.createContext(init));
18052
- target.Provider._context = target;
18053
- target.Consumer._context = target;
18054
- return target;
18055
  }
18056
 
18057
- const SpringRef = () => {
18058
- const current = [];
 
 
 
 
 
18059
 
18060
- const SpringRef = function SpringRef(props) {
18061
- deprecateDirectCall();
18062
- const results = [];
18063
- react_spring_shared_esm_each(current, (ctrl, i) => {
18064
- if (react_spring_shared_esm_is.und(props)) {
18065
- results.push(ctrl.start());
18066
- } else {
18067
- const update = _getProps(props, ctrl, i);
18068
 
18069
- if (update) {
18070
- results.push(ctrl.start(update));
18071
- }
18072
- }
18073
- });
18074
- return results;
18075
- };
18076
 
18077
- SpringRef.current = current;
18078
 
18079
- SpringRef.add = function (ctrl) {
18080
- if (!current.includes(ctrl)) {
18081
- current.push(ctrl);
18082
  }
18083
- };
18084
-
18085
- SpringRef.delete = function (ctrl) {
18086
- const i = current.indexOf(ctrl);
18087
- if (~i) current.splice(i, 1);
18088
- };
18089
-
18090
- SpringRef.pause = function () {
18091
- react_spring_shared_esm_each(current, ctrl => ctrl.pause(...arguments));
18092
- return this;
18093
- };
18094
 
18095
- SpringRef.resume = function () {
18096
- react_spring_shared_esm_each(current, ctrl => ctrl.resume(...arguments));
18097
- return this;
18098
- };
18099
 
18100
- SpringRef.set = function (values) {
18101
- react_spring_shared_esm_each(current, ctrl => ctrl.set(values));
18102
- };
 
 
 
 
 
18103
 
18104
- SpringRef.start = function (props) {
18105
- const results = [];
18106
- react_spring_shared_esm_each(current, (ctrl, i) => {
18107
- if (react_spring_shared_esm_is.und(props)) {
18108
- results.push(ctrl.start());
18109
- } else {
18110
- const update = this._getProps(props, ctrl, i);
 
 
 
 
 
 
 
 
 
 
18111
 
18112
- if (update) {
18113
- results.push(ctrl.start(update));
18114
- }
18115
  }
18116
- });
18117
- return results;
18118
- };
18119
 
18120
- SpringRef.stop = function () {
18121
- react_spring_shared_esm_each(current, ctrl => ctrl.stop(...arguments));
18122
- return this;
18123
- };
 
18124
 
18125
- SpringRef.update = function (props) {
18126
- react_spring_shared_esm_each(current, (ctrl, i) => ctrl.update(this._getProps(props, ctrl, i)));
18127
- return this;
18128
- };
 
 
18129
 
18130
- const _getProps = function _getProps(arg, ctrl, index) {
18131
- return react_spring_shared_esm_is.fun(arg) ? arg(index, ctrl) : arg;
18132
- };
18133
 
18134
- SpringRef._getProps = _getProps;
18135
- return SpringRef;
18136
- };
18137
 
18138
- function useSprings(length, props, deps) {
18139
- const propsFn = react_spring_shared_esm_is.fun(props) && props;
18140
- if (propsFn && !deps) deps = [];
18141
- const ref = (0,external_React_.useMemo)(() => propsFn || arguments.length == 3 ? SpringRef() : void 0, []);
18142
- const layoutId = (0,external_React_.useRef)(0);
18143
- const forceUpdate = react_spring_shared_esm_useForceUpdate();
18144
- const state = (0,external_React_.useMemo)(() => ({
18145
- ctrls: [],
18146
- queue: [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18147
 
18148
- flush(ctrl, updates) {
18149
- const springs = getSprings(ctrl, updates);
18150
- const canFlushSync = layoutId.current > 0 && !state.queue.length && !Object.keys(springs).some(key => !ctrl.springs[key]);
18151
- return canFlushSync ? flushUpdateQueue(ctrl, updates) : new Promise(resolve => {
18152
- setSprings(ctrl, springs);
18153
- state.queue.push(() => {
18154
- resolve(flushUpdateQueue(ctrl, updates));
18155
- });
18156
- forceUpdate();
18157
- });
18158
  }
18159
 
18160
- }), []);
18161
- const ctrls = (0,external_React_.useRef)([...state.ctrls]);
18162
- const updates = [];
18163
- const prevLength = react_spring_shared_esm_usePrev(length) || 0;
18164
- (0,external_React_.useMemo)(() => {
18165
- react_spring_shared_esm_each(ctrls.current.slice(length, prevLength), ctrl => {
18166
- detachRefs(ctrl, ref);
18167
- ctrl.stop(true);
18168
  });
18169
- ctrls.current.length = length;
18170
- declareUpdates(prevLength, length);
18171
- }, [length]);
18172
- (0,external_React_.useMemo)(() => {
18173
- declareUpdates(0, Math.min(prevLength, length));
18174
- }, deps);
18175
-
18176
- function declareUpdates(startIndex, endIndex) {
18177
- for (let i = startIndex; i < endIndex; i++) {
18178
- const ctrl = ctrls.current[i] || (ctrls.current[i] = new Controller(null, state.flush));
18179
- const update = propsFn ? propsFn(i, ctrl) : props[i];
18180
-
18181
- if (update) {
18182
- updates[i] = declareUpdate(update);
18183
- }
18184
- }
18185
- }
18186
 
18187
- const springs = ctrls.current.map((ctrl, i) => getSprings(ctrl, updates[i]));
18188
- const context = (0,external_React_.useContext)(SpringContext);
18189
- const prevContext = react_spring_shared_esm_usePrev(context);
18190
- const hasContext = context !== prevContext && hasProps(context);
18191
- react_spring_shared_esm_useLayoutEffect(() => {
18192
- layoutId.current++;
18193
- state.ctrls = ctrls.current;
18194
- const {
18195
- queue
18196
- } = state;
18197
 
18198
- if (queue.length) {
18199
- state.queue = [];
18200
- react_spring_shared_esm_each(queue, cb => cb());
18201
- }
18202
 
18203
- react_spring_shared_esm_each(ctrls.current, (ctrl, i) => {
18204
- ref == null ? void 0 : ref.add(ctrl);
18205
 
18206
- if (hasContext) {
18207
- ctrl.start({
18208
- default: context
18209
- });
18210
- }
 
 
 
 
 
 
 
 
 
 
18211
 
18212
- const update = updates[i];
 
 
 
 
18213
 
18214
- if (update) {
18215
- replaceRef(ctrl, update.ref);
18216
 
18217
- if (ctrl.ref) {
18218
- ctrl.queue.push(update);
18219
- } else {
18220
- ctrl.start(update);
18221
- }
18222
- }
18223
- });
18224
- });
18225
- react_spring_shared_esm_useOnce(() => () => {
18226
- react_spring_shared_esm_each(state.ctrls, ctrl => ctrl.stop(true));
18227
- });
18228
- const values = springs.map(x => react_spring_core_esm_extends({}, x));
18229
- return ref ? [values, ref] : values;
18230
- }
18231
 
18232
- function useSpring(props, deps) {
18233
- const isFn = react_spring_shared_esm_is.fun(props);
18234
- const [[values], ref] = useSprings(1, isFn ? props : [props], isFn ? deps || [] : deps);
18235
- return isFn || arguments.length == 2 ? [values, ref] : values;
18236
- }
18237
 
18238
- const initSpringRef = () => SpringRef();
 
 
 
 
18239
 
18240
- const useSpringRef = () => useState(initSpringRef)[0];
18241
 
18242
- function useTrail(length, propsArg, deps) {
18243
- const propsFn = is.fun(propsArg) && propsArg;
18244
- if (propsFn && !deps) deps = [];
18245
- let reverse = true;
18246
- const result = useSprings(length, (i, ctrl) => {
18247
- const props = propsFn ? propsFn(i, ctrl) : propsArg;
18248
- reverse = reverse && props.reverse;
18249
- return props;
18250
- }, deps || [{}]);
18251
- const ref = result[1];
18252
- useLayoutEffect(() => {
18253
- each(ref.current, (ctrl, i) => {
18254
- const parent = ref.current[i + (reverse ? 1 : -1)];
18255
- if (parent) ctrl.start({
18256
- to: parent.springs
18257
- });
18258
- });
18259
- }, deps);
18260
 
18261
- if (propsFn || arguments.length == 3) {
18262
- ref['_getProps'] = (propsArg, ctrl, i) => {
18263
- const props = is.fun(propsArg) ? propsArg(i, ctrl) : propsArg;
18264
 
18265
- if (props) {
18266
- const parent = ref.current[i + (props.reverse ? 1 : -1)];
18267
- if (parent) props.to = parent.springs;
18268
- return props;
18269
- }
18270
  };
18271
-
18272
- return result;
18273
  }
 
 
 
18274
 
18275
- return result[0];
18276
- }
18277
 
18278
- let TransitionPhase;
 
 
 
18279
 
18280
- (function (TransitionPhase) {
18281
- TransitionPhase["MOUNT"] = "mount";
18282
- TransitionPhase["ENTER"] = "enter";
18283
- TransitionPhase["UPDATE"] = "update";
18284
- TransitionPhase["LEAVE"] = "leave";
18285
- })(TransitionPhase || (TransitionPhase = {}));
18286
 
18287
- function useTransition(data, props, deps) {
18288
- const propsFn = is.fun(props) && props;
18289
- const {
18290
- reset,
18291
- sort,
18292
- trail = 0,
18293
- expires = true,
18294
- onDestroyed,
18295
- ref: propsRef,
18296
- config: propsConfig
18297
- } = propsFn ? propsFn() : props;
18298
- const ref = useMemo(() => propsFn || arguments.length == 3 ? SpringRef() : void 0, []);
18299
- const items = toArray(data);
18300
- const transitions = [];
18301
- const usedTransitions = useRef(null);
18302
- const prevTransitions = reset ? null : usedTransitions.current;
18303
- useLayoutEffect(() => {
18304
- usedTransitions.current = transitions;
18305
- });
18306
- useOnce(() => () => each(usedTransitions.current, t => {
18307
- if (t.expired) {
18308
- clearTimeout(t.expirationId);
18309
- }
18310
 
18311
- detachRefs(t.ctrl, ref);
18312
- t.ctrl.stop(true);
18313
- }));
18314
- const keys = getKeys(items, propsFn ? propsFn() : props, prevTransitions);
18315
- const expired = reset && usedTransitions.current || [];
18316
- useLayoutEffect(() => each(expired, ({
18317
- ctrl,
18318
- item,
18319
- key
18320
- }) => {
18321
- detachRefs(ctrl, ref);
18322
- callProp(onDestroyed, item, key);
18323
- }));
18324
- const reused = [];
18325
- if (prevTransitions) each(prevTransitions, (t, i) => {
18326
- if (t.expired) {
18327
- clearTimeout(t.expirationId);
18328
- expired.push(t);
18329
  } else {
18330
- i = reused[i] = keys.indexOf(t.key);
18331
- if (~i) transitions[i] = t;
18332
- }
18333
- });
18334
- each(items, (item, i) => {
18335
- if (!transitions[i]) {
18336
- transitions[i] = {
18337
- key: keys[i],
18338
- item,
18339
- phase: TransitionPhase.MOUNT,
18340
- ctrl: new Controller()
18341
- };
18342
- transitions[i].ctrl.item = item;
18343
  }
18344
- });
 
 
 
18345
 
18346
- if (reused.length) {
18347
- let i = -1;
18348
- const {
18349
- leave
18350
- } = propsFn ? propsFn() : props;
18351
- each(reused, (keyIndex, prevIndex) => {
18352
- const t = prevTransitions[prevIndex];
18353
 
18354
- if (~keyIndex) {
18355
- i = transitions.indexOf(t);
18356
- transitions[i] = react_spring_core_esm_extends({}, t, {
18357
- item: items[keyIndex]
18358
- });
18359
- } else if (leave) {
18360
- transitions.splice(++i, 0, t);
 
18361
  }
18362
- });
18363
  }
 
 
 
18364
 
18365
- if (is.fun(sort)) {
18366
- transitions.sort((a, b) => sort(a.item, b.item));
 
18367
  }
 
 
 
18368
 
18369
- let delay = -trail;
18370
- const forceUpdate = useForceUpdate();
18371
- const defaultProps = getDefaultProps(props);
18372
- const changes = new Map();
18373
- each(transitions, (t, i) => {
18374
- const key = t.key;
18375
- const prevPhase = t.phase;
18376
- const p = propsFn ? propsFn() : props;
18377
- let to;
18378
- let phase;
18379
- let propsDelay = callProp(p.delay || 0, key);
18380
 
18381
- if (prevPhase == TransitionPhase.MOUNT) {
18382
- to = p.enter;
18383
- phase = TransitionPhase.ENTER;
18384
- } else {
18385
- const isLeave = keys.indexOf(key) < 0;
 
18386
 
18387
- if (prevPhase != TransitionPhase.LEAVE) {
18388
- if (isLeave) {
18389
- to = p.leave;
18390
- phase = TransitionPhase.LEAVE;
18391
- } else if (to = p.update) {
18392
- phase = TransitionPhase.UPDATE;
18393
- } else return;
18394
- } else if (!isLeave) {
18395
- to = p.enter;
18396
- phase = TransitionPhase.ENTER;
18397
- } else return;
18398
- }
18399
 
18400
- to = callProp(to, t.item, i);
18401
- to = is.obj(to) ? inferTo(to) : {
18402
- to
18403
- };
 
18404
 
18405
- if (!to.config) {
18406
- const config = propsConfig || defaultProps.config;
18407
- to.config = callProp(config, t.item, i, phase);
 
 
18408
  }
18409
 
18410
- delay += trail;
 
 
 
 
18411
 
18412
- const payload = react_spring_core_esm_extends({}, defaultProps, {
18413
- delay: propsDelay + delay,
18414
- ref: propsRef,
18415
- immediate: p.immediate,
18416
- reset: false
18417
- }, to);
18418
 
18419
- if (phase == TransitionPhase.ENTER && is.und(payload.from)) {
18420
- const _p = propsFn ? propsFn() : props;
18421
 
18422
- const from = is.und(_p.initial) || prevTransitions ? _p.from : _p.initial;
18423
- payload.from = callProp(from, t.item, i);
18424
  }
18425
 
18426
- const {
18427
- onResolve
18428
- } = payload;
18429
-
18430
- payload.onResolve = result => {
18431
- callProp(onResolve, result);
18432
- const transitions = usedTransitions.current;
18433
- const t = transitions.find(t => t.key === key);
18434
- if (!t) return;
18435
-
18436
- if (result.cancelled && t.phase != TransitionPhase.UPDATE) {
18437
- return;
18438
- }
18439
 
18440
- if (t.ctrl.idle) {
18441
- const idle = transitions.every(t => t.ctrl.idle);
18442
 
18443
- if (t.phase == TransitionPhase.LEAVE) {
18444
- const expiry = callProp(expires, t.item);
 
 
 
 
18445
 
18446
- if (expiry !== false) {
18447
- const expiryMs = expiry === true ? 0 : expiry;
18448
- t.expired = true;
18449
 
18450
- if (!idle && expiryMs > 0) {
18451
- if (expiryMs <= 0x7fffffff) t.expirationId = setTimeout(forceUpdate, expiryMs);
18452
- return;
18453
- }
18454
- }
18455
- }
18456
 
18457
- if (idle && transitions.some(t => t.expired)) {
18458
- forceUpdate();
18459
- }
18460
  }
18461
- };
18462
 
18463
- const springs = getSprings(t.ctrl, payload);
18464
- changes.set(t, {
18465
- phase,
18466
- springs,
18467
- payload
18468
- });
18469
- });
18470
- const context = useContext(SpringContext);
18471
- const prevContext = usePrev(context);
18472
- const hasContext = context !== prevContext && hasProps(context);
18473
- useLayoutEffect(() => {
18474
- if (hasContext) each(transitions, t => {
18475
- t.ctrl.start({
18476
- default: context
18477
- });
18478
- });
18479
- }, [context]);
18480
- useLayoutEffect(() => {
18481
- each(changes, ({
18482
- phase,
18483
- payload
18484
- }, t) => {
18485
- const {
18486
- ctrl
18487
- } = t;
18488
- t.phase = phase;
18489
- ref == null ? void 0 : ref.add(ctrl);
18490
 
18491
- if (hasContext && phase == TransitionPhase.ENTER) {
18492
- ctrl.start({
18493
- default: context
18494
- });
18495
- }
18496
 
18497
- if (payload) {
18498
- replaceRef(ctrl, payload.ref);
18499
 
18500
- if (ctrl.ref) {
18501
- ctrl.update(payload);
18502
- } else {
18503
- ctrl.start(payload);
18504
- }
18505
- }
18506
- });
18507
- }, reset ? void 0 : deps);
18508
 
18509
- const renderTransitions = render => React.createElement(React.Fragment, null, transitions.map((t, i) => {
18510
- const {
18511
- springs
18512
- } = changes.get(t) || t.ctrl;
18513
- const elem = render(react_spring_core_esm_extends({}, springs), t.item, t, i);
18514
- return elem && elem.type ? React.createElement(elem.type, react_spring_core_esm_extends({}, elem.props, {
18515
- key: is.str(t.key) || is.num(t.key) ? t.key : t.ctrl.id,
18516
- ref: elem.ref
18517
- })) : elem;
18518
- }));
18519
 
18520
- return ref ? [renderTransitions, ref] : renderTransitions;
18521
- }
18522
- let nextKey = 1;
18523
 
18524
- function getKeys(items, {
18525
- key,
18526
- keys = key
18527
- }, prevTransitions) {
18528
- if (keys === null) {
18529
- const reused = new Set();
18530
- return items.map(item => {
18531
- const t = prevTransitions && prevTransitions.find(t => t.item === item && t.phase !== TransitionPhase.LEAVE && !reused.has(t));
18532
 
18533
- if (t) {
18534
- reused.add(t);
18535
- return t.key;
18536
- }
18537
 
18538
- return nextKey++;
 
 
 
 
 
 
 
18539
  });
18540
  }
 
 
 
18541
 
18542
- return is.und(keys) ? items : is.fun(keys) ? items.map(keys) : toArray(keys);
18543
- }
18544
-
18545
- const _excluded$2 = (/* unused pure expression or super */ null && (["children"]));
18546
- function Spring(_ref) {
18547
- let {
18548
- children
18549
- } = _ref,
18550
- props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
18551
 
18552
- return children(useSpring(props));
18553
- }
18554
 
18555
- const _excluded$1 = (/* unused pure expression or super */ null && (["items", "children"]));
18556
- function Trail(_ref) {
18557
- let {
18558
- items,
18559
- children
18560
- } = _ref,
18561
- props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
18562
 
18563
- const trails = useTrail(items.length, props);
18564
- return items.map((item, index) => {
18565
- const result = children(item, index);
18566
- return is.fun(result) ? result(trails[index]) : result;
18567
- });
18568
- }
18569
 
18570
- const _excluded = (/* unused pure expression or super */ null && (["items", "children"]));
18571
- function Transition(_ref) {
18572
- let {
18573
- items,
18574
- children
18575
- } = _ref,
18576
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
 
 
18577
 
18578
- return useTransition(items, props)(children);
18579
- }
18580
 
18581
- class Interpolation extends FrameValue {
18582
- constructor(source, args) {
18583
- super();
18584
- this.key = void 0;
18585
- this.idle = true;
18586
- this.calc = void 0;
18587
- this._active = new Set();
18588
- this.source = source;
18589
- this.calc = createInterpolator(...args);
18590
 
18591
- const value = this._get();
18592
 
18593
- const nodeType = getAnimatedType(value);
18594
- setAnimated(this, nodeType.create(value));
18595
- }
18596
 
18597
- advance(_dt) {
18598
- const value = this._get();
18599
 
18600
- const oldValue = this.get();
 
 
18601
 
18602
- if (!isEqual(value, oldValue)) {
18603
- getAnimated(this).setValue(value);
18604
 
18605
- this._onChange(value, this.idle);
18606
- }
 
 
 
 
18607
 
18608
- if (!this.idle && checkIdle(this._active)) {
18609
- becomeIdle(this);
18610
- }
18611
  }
 
 
 
18612
 
18613
- _get() {
18614
- const inputs = react_spring_shared_esm_is.arr(this.source) ? this.source.map(getFluidValue) : react_spring_shared_esm_toArray(getFluidValue(this.source));
18615
- return this.calc(...inputs);
18616
- }
18617
 
18618
- _start() {
18619
- if (this.idle && !checkIdle(this._active)) {
18620
- this.idle = false;
18621
- react_spring_shared_esm_each(getPayload(this), node => {
18622
- node.done = false;
18623
- });
18624
 
18625
- if (globals.skipAnimation) {
18626
- raf.batchedUpdates(() => this.advance());
18627
- becomeIdle(this);
18628
- } else {
18629
- frameLoop.start(this);
18630
- }
18631
  }
18632
- }
18633
 
18634
- _attach() {
18635
- let priority = 1;
18636
- react_spring_shared_esm_each(react_spring_shared_esm_toArray(this.source), source => {
18637
- if (hasFluidValue(source)) {
18638
- addFluidObserver(source, this);
18639
- }
18640
 
18641
- if (isFrameValue(source)) {
18642
- if (!source.idle) {
18643
- this._active.add(source);
18644
- }
18645
 
18646
- priority = Math.max(priority, source.priority + 1);
 
 
 
18647
  }
18648
- });
18649
- this.priority = priority;
18650
 
18651
- this._start();
 
 
 
 
18652
  }
 
 
 
18653
 
18654
- _detach() {
18655
- react_spring_shared_esm_each(react_spring_shared_esm_toArray(this.source), source => {
18656
- if (hasFluidValue(source)) {
18657
- removeFluidObserver(source, this);
18658
- }
18659
- });
18660
 
18661
- this._active.clear();
 
 
 
18662
 
18663
- becomeIdle(this);
18664
- }
 
 
18665
 
18666
- eventObserved(event) {
18667
- if (event.type == 'change') {
18668
- if (event.idle) {
18669
- this.advance();
18670
- } else {
18671
- this._active.add(event.parent);
18672
 
18673
- this._start();
18674
- }
18675
- } else if (event.type == 'idle') {
18676
- this._active.delete(event.parent);
18677
- } else if (event.type == 'priority') {
18678
- this.priority = react_spring_shared_esm_toArray(this.source).reduce((highest, parent) => Math.max(highest, (isFrameValue(parent) ? parent.priority : 0) + 1), 0);
18679
- }
18680
  }
 
 
 
18681
 
18682
- }
18683
 
18684
- function isIdle(source) {
18685
- return source.idle !== false;
18686
- }
18687
 
18688
- function checkIdle(active) {
18689
- return !active.size || Array.from(active).every(isIdle);
18690
- }
18691
 
18692
- function becomeIdle(self) {
18693
- if (!self.idle) {
18694
- self.idle = true;
18695
- react_spring_shared_esm_each(getPayload(self), node => {
18696
- node.done = true;
18697
- });
18698
- callFluidObservers(self, {
18699
- type: 'idle',
18700
- parent: self
18701
- });
18702
- }
18703
- }
18704
 
18705
- const react_spring_core_esm_to = (source, ...args) => new Interpolation(source, args);
18706
- const react_spring_core_esm_interpolate = (source, ...args) => (deprecateInterpolate(), new Interpolation(source, args));
18707
 
18708
- globals.assign({
18709
- createStringInterpolator: createStringInterpolator,
18710
- to: (source, args) => new Interpolation(source, args)
18711
- });
18712
- const react_spring_core_esm_update = frameLoop.advance;
18713
 
 
18714
 
 
 
 
18715
 
18716
- ;// CONCATENATED MODULE: external "ReactDOM"
18717
- var external_ReactDOM_namespaceObject = window["ReactDOM"];
18718
- ;// CONCATENATED MODULE: ./node_modules/@react-spring/web/dist/react-spring-web.esm.js
18719
 
 
 
 
 
18720
 
 
 
 
18721
 
 
 
 
 
 
 
 
 
 
 
18722
 
18723
 
 
 
 
18724
 
18725
- function react_spring_web_esm_objectWithoutPropertiesLoose(source, excluded) {
18726
- if (source == null) return {};
18727
- var target = {};
18728
- var sourceKeys = Object.keys(source);
18729
- var key, i;
18730
 
18731
- for (i = 0; i < sourceKeys.length; i++) {
18732
- key = sourceKeys[i];
18733
- if (excluded.indexOf(key) >= 0) continue;
18734
- target[key] = source[key];
18735
- }
18736
 
18737
- return target;
18738
- }
 
18739
 
18740
- const react_spring_web_esm_excluded$2 = ["style", "children", "scrollTop", "scrollLeft"];
18741
- const isCustomPropRE = /^--/;
18742
 
18743
- function dangerousStyleValue(name, value) {
18744
- if (value == null || typeof value === 'boolean' || value === '') return '';
18745
- if (typeof value === 'number' && value !== 0 && !isCustomPropRE.test(name) && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) return value + 'px';
18746
- return ('' + value).trim();
18747
- }
18748
 
18749
- const attributeCache = {};
18750
- function applyAnimatedValues(instance, props) {
18751
- if (!instance.nodeType || !instance.setAttribute) {
18752
- return false;
 
18753
  }
 
 
 
18754
 
18755
- const isFilterElement = instance.nodeName === 'filter' || instance.parentNode && instance.parentNode.nodeName === 'filter';
18756
 
18757
- const _ref = props,
18758
- {
18759
- style,
18760
- children,
18761
- scrollTop,
18762
- scrollLeft
18763
- } = _ref,
18764
- attributes = react_spring_web_esm_objectWithoutPropertiesLoose(_ref, react_spring_web_esm_excluded$2);
18765
 
18766
- const values = Object.values(attributes);
18767
- const names = Object.keys(attributes).map(name => isFilterElement || instance.hasAttribute(name) ? name : attributeCache[name] || (attributeCache[name] = name.replace(/([A-Z])/g, n => '-' + n.toLowerCase())));
 
18768
 
18769
- if (children !== void 0) {
18770
- instance.textContent = children;
18771
- }
18772
 
18773
- for (let name in style) {
18774
- if (style.hasOwnProperty(name)) {
18775
- const value = dangerousStyleValue(name, style[name]);
18776
 
18777
- if (isCustomPropRE.test(name)) {
18778
- instance.style.setProperty(name, value);
18779
- } else {
18780
- instance.style[name] = value;
18781
- }
18782
  }
 
 
 
 
 
18783
  }
 
 
 
18784
 
18785
- names.forEach((name, i) => {
18786
- instance.setAttribute(name, values[i]);
18787
- });
18788
 
18789
- if (scrollTop !== void 0) {
18790
- instance.scrollTop = scrollTop;
18791
- }
18792
 
18793
- if (scrollLeft !== void 0) {
18794
- instance.scrollLeft = scrollLeft;
18795
- }
18796
- }
18797
- let isUnitlessNumber = {
18798
- animationIterationCount: true,
18799
- borderImageOutset: true,
18800
- borderImageSlice: true,
18801
- borderImageWidth: true,
18802
- boxFlex: true,
18803
- boxFlexGroup: true,
18804
- boxOrdinalGroup: true,
18805
- columnCount: true,
18806
- columns: true,
18807
- flex: true,
18808
- flexGrow: true,
18809
- flexPositive: true,
18810
- flexShrink: true,
18811
- flexNegative: true,
18812
- flexOrder: true,
18813
- gridRow: true,
18814
- gridRowEnd: true,
18815
- gridRowSpan: true,
18816
- gridRowStart: true,
18817
- gridColumn: true,
18818
- gridColumnEnd: true,
18819
- gridColumnSpan: true,
18820
- gridColumnStart: true,
18821
- fontWeight: true,
18822
- lineClamp: true,
18823
- lineHeight: true,
18824
- opacity: true,
18825
- order: true,
18826
- orphans: true,
18827
- tabSize: true,
18828
- widows: true,
18829
- zIndex: true,
18830
- zoom: true,
18831
- fillOpacity: true,
18832
- floodOpacity: true,
18833
- stopOpacity: true,
18834
- strokeDasharray: true,
18835
- strokeDashoffset: true,
18836
- strokeMiterlimit: true,
18837
- strokeOpacity: true,
18838
- strokeWidth: true
18839
- };
18840
 
18841
- const prefixKey = (prefix, key) => prefix + key.charAt(0).toUpperCase() + key.substring(1);
18842
 
18843
- const prefixes = ['Webkit', 'Ms', 'Moz', 'O'];
18844
- isUnitlessNumber = Object.keys(isUnitlessNumber).reduce((acc, prop) => {
18845
- prefixes.forEach(prefix => acc[prefixKey(prefix, prop)] = acc[prop]);
18846
- return acc;
18847
- }, isUnitlessNumber);
18848
 
18849
- const react_spring_web_esm_excluded$1 = ["x", "y", "z"];
18850
- const domTransforms = /^(matrix|translate|scale|rotate|skew)/;
18851
- const pxTransforms = /^(translate)/;
18852
- const degTransforms = /^(rotate|skew)/;
18853
 
18854
- const addUnit = (value, unit) => react_spring_shared_esm_is.num(value) && value !== 0 ? value + unit : value;
 
 
18855
 
18856
- const isValueIdentity = (value, id) => react_spring_shared_esm_is.arr(value) ? value.every(v => isValueIdentity(v, id)) : react_spring_shared_esm_is.num(value) ? value === id : parseFloat(value) === id;
 
 
 
 
 
 
 
 
18857
 
18858
- class AnimatedStyle extends AnimatedObject {
18859
- constructor(_ref) {
18860
- let {
18861
- x,
18862
- y,
18863
- z
18864
- } = _ref,
18865
- style = react_spring_web_esm_objectWithoutPropertiesLoose(_ref, react_spring_web_esm_excluded$1);
18866
 
18867
- const inputs = [];
18868
- const transforms = [];
 
18869
 
18870
- if (x || y || z) {
18871
- inputs.push([x || 0, y || 0, z || 0]);
18872
- transforms.push(xyz => [`translate3d(${xyz.map(v => addUnit(v, 'px')).join(',')})`, isValueIdentity(xyz, 0)]);
18873
  }
18874
 
18875
- eachProp(style, (value, key) => {
18876
- if (key === 'transform') {
18877
- inputs.push([value || '']);
18878
- transforms.push(transform => [transform, transform === '']);
18879
- } else if (domTransforms.test(key)) {
18880
- delete style[key];
18881
- if (react_spring_shared_esm_is.und(value)) return;
18882
- const unit = pxTransforms.test(key) ? 'px' : degTransforms.test(key) ? 'deg' : '';
18883
- inputs.push(react_spring_shared_esm_toArray(value));
18884
- transforms.push(key === 'rotate3d' ? ([x, y, z, deg]) => [`rotate3d(${x},${y},${z},${addUnit(deg, unit)})`, isValueIdentity(deg, 0)] : input => [`${key}(${input.map(v => addUnit(v, unit)).join(',')})`, isValueIdentity(input, key.startsWith('scale') ? 1 : 0)]);
18885
- }
18886
  });
 
 
 
 
18887
 
18888
- if (inputs.length) {
18889
- style.transform = new FluidTransform(inputs, transforms);
 
 
 
 
 
18890
  }
18891
 
18892
- super(style);
18893
- }
18894
 
18895
- }
 
 
18896
 
18897
- class FluidTransform extends FluidValue {
18898
- constructor(inputs, transforms) {
18899
- super();
18900
- this._value = null;
18901
- this.inputs = inputs;
18902
- this.transforms = transforms;
18903
- }
18904
 
18905
- get() {
18906
- return this._value || (this._value = this._get());
18907
- }
18908
 
18909
- _get() {
18910
- let transform = '';
18911
- let identity = true;
18912
- react_spring_shared_esm_each(this.inputs, (input, i) => {
18913
- const arg1 = getFluidValue(input[0]);
18914
- const [t, id] = this.transforms[i](react_spring_shared_esm_is.arr(arg1) ? arg1 : input.map(getFluidValue));
18915
- transform += ' ' + t;
18916
- identity = identity && id;
 
 
 
 
 
18917
  });
18918
- return identity ? 'none' : transform;
18919
  }
 
 
 
18920
 
18921
- observerAdded(count) {
18922
- if (count == 1) react_spring_shared_esm_each(this.inputs, input => react_spring_shared_esm_each(input, value => hasFluidValue(value) && addFluidObserver(value, this)));
18923
- }
18924
 
18925
- observerRemoved(count) {
18926
- if (count == 0) react_spring_shared_esm_each(this.inputs, input => react_spring_shared_esm_each(input, value => hasFluidValue(value) && removeFluidObserver(value, this)));
18927
- }
18928
 
18929
- eventObserved(event) {
18930
- if (event.type == 'change') {
18931
- this._value = null;
18932
  }
18933
 
18934
- callFluidObservers(this, event);
18935
- }
18936
 
18937
- }
 
 
18938
 
18939
- const primitives = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', 'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan'];
18940
 
18941
- const react_spring_web_esm_excluded = ["scrollTop", "scrollLeft"];
18942
- globals.assign({
18943
- batchedUpdates: external_ReactDOM_namespaceObject.unstable_batchedUpdates,
18944
- createStringInterpolator: createStringInterpolator,
18945
- colors: colors
18946
- });
18947
- const host = createHost(primitives, {
18948
- applyAnimatedValues,
18949
- createAnimatedStyle: style => new AnimatedStyle(style),
18950
- getComponentProps: _ref => {
18951
- let props = react_spring_web_esm_objectWithoutPropertiesLoose(_ref, react_spring_web_esm_excluded);
18952
 
18953
- return props;
 
 
 
 
 
18954
  }
18955
- });
18956
- const animated = host.animated;
 
18957
 
18958
 
 
 
 
18959
 
18960
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/use-moving-animation/index.js
18961
- /**
18962
- * External dependencies
18963
- */
18964
 
18965
- /**
18966
- * WordPress dependencies
18967
- */
18968
 
 
18969
 
 
18970
 
 
 
 
 
18971
 
18972
- /**
18973
- * Simple reducer used to increment a counter.
18974
- *
18975
- * @param {number} state Previous counter value.
18976
- * @return {number} New state value.
18977
- */
18978
 
18979
- const counterReducer = state => state + 1;
 
 
 
 
 
 
 
18980
 
18981
- const getAbsolutePosition = element => {
18982
- return {
18983
- top: element.offsetTop,
18984
- left: element.offsetLeft
18985
- };
18986
- };
18987
- /**
18988
- * Hook used to compute the styles required to move a div into a new position.
18989
- *
18990
- * The way this animation works is the following:
18991
- * - It first renders the element as if there was no animation.
18992
- * - It takes a snapshot of the position of the block to use it
18993
- * as a destination point for the animation.
18994
- * - It restores the element to the previous position using a CSS transform
18995
- * - It uses the "resetAnimation" flag to reset the animation
18996
- * from the beginning in order to animate to the new destination point.
18997
- *
18998
- * @param {Object} $1 Options
18999
- * @param {boolean} $1.isSelected Whether it's the current block or not.
19000
- * @param {boolean} $1.adjustScrolling Adjust the scroll position to the current block.
19001
- * @param {boolean} $1.enableAnimation Enable/Disable animation.
19002
- * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.
19003
- */
19004
 
 
 
 
 
19005
 
19006
- function useMovingAnimation({
19007
- isSelected,
19008
- adjustScrolling,
19009
- enableAnimation,
19010
- triggerAnimationOnChange
19011
- }) {
19012
- const ref = (0,external_wp_element_namespaceObject.useRef)();
19013
- const prefersReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)() || !enableAnimation;
19014
- const [triggeredAnimation, triggerAnimation] = (0,external_wp_element_namespaceObject.useReducer)(counterReducer, 0);
19015
- const [finishedAnimation, endAnimation] = (0,external_wp_element_namespaceObject.useReducer)(counterReducer, 0);
19016
- const [transform, setTransform] = (0,external_wp_element_namespaceObject.useState)({
19017
- x: 0,
19018
- y: 0
19019
- });
19020
- const previous = (0,external_wp_element_namespaceObject.useMemo)(() => ref.current ? getAbsolutePosition(ref.current) : null, [triggerAnimationOnChange]); // Calculate the previous position of the block relative to the viewport and
19021
- // return a function to maintain that position by scrolling.
19022
 
19023
- const preserveScrollPosition = (0,external_wp_element_namespaceObject.useMemo)(() => {
19024
- if (!adjustScrolling || !ref.current) {
19025
- return () => {};
19026
- }
19027
 
19028
- const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(ref.current);
19029
 
19030
- if (!scrollContainer) {
19031
- return () => {};
19032
- }
 
19033
 
19034
- const prevRect = ref.current.getBoundingClientRect();
19035
- return () => {
19036
- const blockRect = ref.current.getBoundingClientRect();
19037
- const diff = blockRect.top - prevRect.top;
19038
 
19039
- if (diff) {
19040
- scrollContainer.scrollTop += diff;
 
 
 
 
 
 
19041
  }
 
 
 
 
 
 
19042
  };
19043
- }, [triggerAnimationOnChange, adjustScrolling]);
19044
- (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
19045
- if (triggeredAnimation) {
19046
- endAnimation();
19047
- }
19048
- }, [triggeredAnimation]);
19049
- (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
19050
- if (!previous) {
19051
  return;
19052
  }
19053
 
19054
- if (prefersReducedMotion) {
19055
- // if the animation is disabled and the scroll needs to be adjusted,
19056
- // just move directly to the final scroll position.
19057
- preserveScrollPosition();
19058
- return;
 
 
 
 
 
 
 
 
19059
  }
19060
 
19061
- ref.current.style.transform = '';
19062
- const destination = getAbsolutePosition(ref.current);
19063
- triggerAnimation();
19064
- setTransform({
19065
- x: Math.round(previous.left - destination.left),
19066
- y: Math.round(previous.top - destination.top)
19067
  });
19068
- }, [triggerAnimationOnChange]); // Only called when either the x or y value changes.
19069
 
19070
- function onFrameChange({
19071
- x,
19072
- y
19073
- }) {
19074
- if (!ref.current) {
19075
- return;
19076
- }
19077
 
19078
- const isMoving = x === 0 && y === 0;
19079
- ref.current.style.transformOrigin = isMoving ? '' : 'center';
19080
- ref.current.style.transform = isMoving ? '' : `translate3d(${x}px,${y}px,0)`;
19081
- ref.current.style.zIndex = !isSelected || isMoving ? '' : '1';
19082
- preserveScrollPosition();
19083
- } // Called for every frame computed by useSpring.
19084
 
19085
 
19086
- function onChange({
19087
- value
19088
- }) {
19089
- let {
19090
- x,
19091
- y
19092
- } = value;
19093
- x = Math.round(x);
19094
- y = Math.round(y);
19095
 
19096
- if (x !== onChange.x || y !== onChange.y) {
19097
- onFrameChange({
19098
- x,
19099
- y
 
 
19100
  });
19101
- onChange.x = x;
19102
- onChange.y = y;
19103
  }
19104
  }
19105
 
19106
- onChange.x = 0;
19107
- onChange.y = 0;
19108
- useSpring({
19109
- from: {
19110
- x: transform.x,
19111
- y: transform.y
19112
- },
19113
- to: {
19114
- x: 0,
19115
- y: 0
19116
- },
19117
- reset: triggeredAnimation !== finishedAnimation,
19118
- config: {
19119
- mass: 5,
19120
- tension: 2000,
19121
- friction: 200
19122
- },
19123
- immediate: prefersReducedMotion,
19124
- onChange
19125
- });
19126
- return ref;
19127
  }
 
 
 
 
 
 
 
 
19128
 
19129
- /* harmony default export */ var use_moving_animation = (useMovingAnimation);
19130
- //# sourceMappingURL=index.js.map
19131
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/dom.js
19132
- const BLOCK_SELECTOR = '.block-editor-block-list__block';
19133
- const APPENDER_SELECTOR = '.block-list-appender';
19134
  /**
19135
- * Returns true if two elements are contained within the same block.
19136
- *
19137
- * @param {Element} a First element.
19138
- * @param {Element} b Second element.
19139
- *
19140
- * @return {boolean} Whether elements are in the same block.
19141
  */
19142
 
19143
- function isInSameBlock(a, b) {
19144
- return a.closest(BLOCK_SELECTOR) === b.closest(BLOCK_SELECTOR);
19145
  }
19146
  /**
19147
- * Returns true if an element is considered part of the block and not its inner
19148
- * blocks or appender.
19149
- *
19150
- * @param {Element} blockElement Block container element.
19151
- * @param {Element} element Element.
19152
- *
19153
- * @return {boolean} Whether an element is considered part of the block and not
19154
- * its inner blocks or appender.
19155
  */
19156
 
19157
- function isInsideRootBlock(blockElement, element) {
19158
- const parentBlock = element.closest([BLOCK_SELECTOR, APPENDER_SELECTOR].join(','));
19159
- return parentBlock === blockElement;
19160
- }
19161
  /**
19162
- * Finds the block client ID given any DOM node inside the block.
19163
- *
19164
- * @param {Node?} node DOM node.
19165
- *
19166
- * @return {string|undefined} Client ID or undefined if the node is not part of
19167
- * a block.
19168
  */
19169
 
19170
- function getBlockClientId(node) {
19171
- while (node && node.nodeType !== node.ELEMENT_NODE) {
19172
- node = node.parentNode;
19173
- }
19174
 
19175
- if (!node) {
19176
- return;
19177
- }
 
 
 
19178
 
19179
- const elementNode =
19180
- /** @type {Element} */
19181
- node;
19182
- const blockNode = elementNode.closest(BLOCK_SELECTOR);
19183
 
19184
- if (!blockNode) {
19185
- return;
 
 
 
 
 
 
 
 
19186
  }
19187
 
19188
- return blockNode.id.slice('block-'.length);
19189
- }
19190
- //# sourceMappingURL=dom.js.map
19191
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-focus-first-element.js
 
 
 
19192
  /**
19193
  * External dependencies
19194
  */
19195
 
19196
  /**
19197
- * WordPress dependencies
19198
  */
19199
 
19200
 
19201
-
19202
-
19203
  /**
19204
- * Internal dependencies
19205
  */
19206
 
 
 
 
 
19207
 
19208
-
19209
- /** @typedef {import('@wordpress/element').RefObject} RefObject */
19210
-
19211
  /**
19212
- * Returns the initial position if the block needs to be focussed, `undefined`
19213
- * otherwise. The initial position is either 0 (start) or -1 (end).
19214
- *
19215
- * @param {string} clientId Block client ID.
19216
- *
19217
- * @return {number} The initial position, either 0 (start) or -1 (end).
19218
  */
19219
 
19220
- function useInitialPosition(clientId) {
19221
- return (0,external_wp_data_namespaceObject.useSelect)(select => {
19222
- const {
19223
- getSelectedBlocksInitialCaretPosition,
19224
- isMultiSelecting,
19225
- isNavigationMode,
19226
- isBlockSelected
19227
- } = select(store);
19228
 
19229
- if (!isBlockSelected(clientId)) {
19230
- return;
19231
- }
 
19232
 
19233
- if (isMultiSelecting() || isNavigationMode()) {
19234
- return;
19235
- } // If there's no initial position, return 0 to focus the start.
 
 
 
19236
 
19237
 
19238
- return getSelectedBlocksInitialCaretPosition();
19239
- }, [clientId]);
19240
- }
19241
  /**
19242
- * Transitions focus to the block or inner tabbable when the block becomes
19243
- * selected and an initial position is set.
19244
- *
19245
- * @param {string} clientId Block client ID.
19246
- *
19247
- * @return {RefObject} React ref with the block element.
19248
  */
19249
 
19250
 
19251
- function useFocusFirstElement(clientId) {
19252
- const ref = (0,external_wp_element_namespaceObject.useRef)();
19253
- const initialPosition = useInitialPosition(clientId);
19254
- (0,external_wp_element_namespaceObject.useEffect)(() => {
19255
- if (initialPosition === undefined || initialPosition === null) {
19256
- return;
19257
- }
19258
 
19259
- if (!ref.current) {
19260
- return;
19261
- }
19262
 
19263
- const {
19264
- ownerDocument
19265
- } = ref.current; // Do not focus the block if it already contains the active element.
 
 
 
19266
 
19267
- if (ref.current.contains(ownerDocument.activeElement)) {
19268
- return;
19269
- } // Find all tabbables within node.
19270
 
 
 
 
 
 
 
 
19271
 
19272
- const textInputs = external_wp_dom_namespaceObject.focus.tabbable.find(ref.current).filter(node => (0,external_wp_dom_namespaceObject.isTextField)(node)); // If reversed (e.g. merge via backspace), use the last in the set of
19273
- // tabbables.
19274
 
19275
- const isReverse = -1 === initialPosition;
19276
- const target = (isReverse ? external_lodash_namespaceObject.last : external_lodash_namespaceObject.first)(textInputs) || ref.current;
 
 
 
 
19277
 
19278
- if (!isInsideRootBlock(ref.current, target)) {
19279
- ref.current.focus();
19280
- return;
19281
- }
19282
 
19283
- (0,external_wp_dom_namespaceObject.placeCaretAtHorizontalEdge)(target, isReverse);
19284
- }, [initialPosition]);
19285
- return ref;
19286
- }
19287
- //# sourceMappingURL=use-focus-first-element.js.map
19288
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-is-hovered.js
19289
  /**
19290
- * WordPress dependencies
19291
  */
19292
 
19293
 
 
 
 
19294
  /**
19295
- * Internal dependencies
19296
  */
19297
 
19298
 
19299
-
19300
- function listener(event) {
19301
- if (event.defaultPrevented) {
19302
- return;
19303
- }
19304
-
19305
- const action = event.type === 'mouseover' ? 'add' : 'remove';
19306
- event.preventDefault();
19307
- event.currentTarget.classList[action]('is-hovered');
19308
- }
19309
  /**
19310
- * Adds `is-hovered` class when the block is hovered and in navigation or
19311
- * outline mode.
19312
  */
19313
 
19314
 
19315
- function useIsHovered() {
19316
- const isEnabled = (0,external_wp_data_namespaceObject.useSelect)(select => {
19317
- const {
19318
- isNavigationMode,
19319
- getSettings
19320
- } = select(store);
19321
- return isNavigationMode() || getSettings().outlineMode;
19322
- }, []);
19323
- return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
19324
- if (isEnabled) {
19325
- node.addEventListener('mouseout', listener);
19326
- node.addEventListener('mouseover', listener);
19327
- return () => {
19328
- node.removeEventListener('mouseout', listener);
19329
- node.removeEventListener('mouseover', listener); // Remove class in case it lingers.
19330
-
19331
- node.classList.remove('is-hovered');
19332
- };
19333
- }
19334
- }, [isEnabled]);
19335
- }
19336
- //# sourceMappingURL=use-is-hovered.js.map
19337
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-block-class-names.js
19338
  /**
19339
- * External dependencies
19340
  */
19341
 
 
 
 
 
 
19342
  /**
19343
- * WordPress dependencies
19344
  */
19345
 
19346
 
19347
-
 
 
19348
  /**
19349
- * Internal dependencies
19350
  */
19351
 
19352
 
 
 
 
19353
  /**
19354
- * Returns the class names used for the different states of the block.
19355
- *
19356
- * @param {string} clientId The block client ID.
19357
- *
19358
- * @return {string} The class names.
19359
  */
19360
 
19361
- function useBlockClassNames(clientId) {
19362
- return (0,external_wp_data_namespaceObject.useSelect)(select => {
19363
- const {
19364
- isBlockBeingDragged,
19365
- isBlockHighlighted,
19366
- isBlockSelected,
19367
- isBlockMultiSelected,
19368
- getBlockName,
19369
- getSettings,
19370
- hasSelectedInnerBlock,
19371
- isTyping,
19372
- __experimentalGetActiveBlockIdByBlockNames: getActiveBlockIdByBlockNames
19373
- } = select(store);
19374
- const {
19375
- __experimentalSpotlightEntityBlocks: spotlightEntityBlocks,
19376
- outlineMode
19377
- } = getSettings();
19378
- const isDragging = isBlockBeingDragged(clientId);
19379
- const isSelected = isBlockSelected(clientId);
19380
- const name = getBlockName(clientId);
19381
- const checkDeep = true; // "ancestor" is the more appropriate label due to "deep" check
19382
 
19383
- const isAncestorOfSelectedBlock = hasSelectedInnerBlock(clientId, checkDeep);
19384
- const activeEntityBlockId = getActiveBlockIdByBlockNames(spotlightEntityBlocks);
19385
- return classnames_default()({
19386
- 'is-selected': isSelected,
19387
- 'is-highlighted': isBlockHighlighted(clientId),
19388
- 'is-multi-selected': isBlockMultiSelected(clientId),
19389
- 'is-reusable': (0,external_wp_blocks_namespaceObject.isReusableBlock)((0,external_wp_blocks_namespaceObject.getBlockType)(name)),
19390
- 'is-dragging': isDragging,
19391
- 'has-child-selected': isAncestorOfSelectedBlock,
19392
- 'has-active-entity': activeEntityBlockId,
19393
- // Determine if there is an active entity area to spotlight.
19394
- 'is-active-entity': activeEntityBlockId === clientId,
19395
- 'remove-outline': isSelected && outlineMode && isTyping()
19396
- });
19397
- }, [clientId]);
19398
- }
19399
- //# sourceMappingURL=use-block-class-names.js.map
19400
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-block-default-class-name.js
19401
  /**
19402
- * WordPress dependencies
19403
  */
19404
 
19405
 
19406
- /**
19407
- * Internal dependencies
19408
- */
19409
 
 
 
 
19410
 
 
 
19411
  /**
19412
- * Returns the default class name if the block is a light block and it supports
19413
- * `className`.
19414
- *
19415
- * @param {string} clientId The block client ID.
19416
- *
19417
- * @return {string} The class name, e.g. `wp-block-paragraph`.
19418
  */
19419
 
19420
- function useBlockDefaultClassName(clientId) {
19421
- return (0,external_wp_data_namespaceObject.useSelect)(select => {
19422
- const name = select(store).getBlockName(clientId);
19423
- const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
19424
- const hasLightBlockWrapper = (blockType === null || blockType === void 0 ? void 0 : blockType.apiVersion) > 1;
19425
 
19426
- if (!hasLightBlockWrapper) {
19427
- return;
19428
- }
 
 
 
 
 
19429
 
19430
- return (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(name);
19431
- }, [clientId]);
19432
- }
19433
- //# sourceMappingURL=use-block-default-class-name.js.map
19434
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-block-custom-class-name.js
19435
  /**
19436
- * WordPress dependencies
19437
  */
19438
 
19439
-
19440
  /**
19441
  * Internal dependencies
19442
  */
19443
 
19444
 
19445
  /**
19446
- * Returns the custom class name if the block is a light block.
19447
- *
19448
- * @param {string} clientId The block client ID.
19449
- *
19450
- * @return {string} The custom class name.
19451
  */
19452
 
19453
- function useBlockCustomClassName(clientId) {
19454
- // It's good for this to be a separate selector because it will be executed
19455
- // on every attribute change, while the other selectors are not re-evaluated
19456
- // as much.
19457
- return (0,external_wp_data_namespaceObject.useSelect)(select => {
19458
- const {
19459
- getBlockName,
19460
- getBlockAttributes
19461
- } = select(store);
19462
- const attributes = getBlockAttributes(clientId);
19463
-
19464
- if (!(attributes !== null && attributes !== void 0 && attributes.className)) {
19465
- return;
19466
- }
19467
 
19468
- const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(getBlockName(clientId));
19469
- const hasLightBlockWrapper = (blockType === null || blockType === void 0 ? void 0 : blockType.apiVersion) > 1;
 
 
 
 
 
 
19470
 
19471
- if (!hasLightBlockWrapper) {
19472
- return;
19473
- }
19474
 
19475
- return attributes.className;
19476
- }, [clientId]);
19477
- }
19478
- //# sourceMappingURL=use-block-custom-class-name.js.map
19479
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-block-moving-mode-class-names.js
19480
  /**
19481
- * External dependencies
19482
  */
19483
 
 
 
 
19484
  /**
19485
- * WordPress dependencies
19486
  */
19487
 
19488
 
 
 
 
19489
  /**
19490
- * Internal dependencies
19491
  */
19492
 
19493
 
 
 
 
19494
  /**
19495
- * Returns the class names used for block moving mode.
19496
- *
19497
- * @param {string} clientId The block client ID to insert above.
19498
- *
19499
- * @return {string} The class names.
19500
  */
19501
 
19502
- function useBlockMovingModeClassNames(clientId) {
19503
- return (0,external_wp_data_namespaceObject.useSelect)(select => {
19504
- const {
19505
- hasBlockMovingClientId,
19506
- canInsertBlockType,
19507
- getBlockName,
19508
- getBlockRootClientId,
19509
- isBlockSelected
19510
- } = select(store); // The classes are only relevant for the selected block. Avoid
19511
- // re-rendering all blocks!
19512
-
19513
- if (!isBlockSelected(clientId)) {
19514
- return;
19515
- }
19516
 
19517
- const movingClientId = hasBlockMovingClientId();
 
 
 
 
 
19518
 
19519
- if (!movingClientId) {
19520
- return;
19521
- }
19522
 
19523
- return classnames_default()('is-block-moving-mode', {
19524
- 'can-insert-moving-block': canInsertBlockType(getBlockName(movingClientId), getBlockRootClientId(clientId))
19525
- });
19526
- }, [clientId]);
19527
- }
19528
- //# sourceMappingURL=use-block-moving-mode-class-names.js.map
19529
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-focus-handler.js
19530
  /**
19531
- * WordPress dependencies
19532
  */
19533
 
19534
 
 
 
 
 
19535
  /**
19536
- * Internal dependencies
19537
  */
19538
 
19539
 
19540
-
 
 
19541
  /**
19542
- * Selects the block if it receives focus.
19543
- *
19544
- * @param {string} clientId Block client ID.
19545
  */
19546
 
19547
- function useFocusHandler(clientId) {
19548
- const {
19549
- isBlockSelected
19550
- } = (0,external_wp_data_namespaceObject.useSelect)(store);
19551
- const {
19552
- selectBlock,
19553
- selectionChange
19554
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
19555
- return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
19556
- /**
19557
- * Marks the block as selected when focused and not already
19558
- * selected. This specifically handles the case where block does not
19559
- * set focus on its own (via `setFocus`), typically if there is no
19560
- * focusable input in the block.
19561
- *
19562
- * @param {FocusEvent} event Focus event.
19563
- */
19564
- function onFocus(event) {
19565
- // Check synchronously because a non-selected block might be
19566
- // getting data through `useSelect` asynchronously.
19567
- if (isBlockSelected(clientId)) {
19568
- // Potentially change selection away from rich text.
19569
- if (!event.target.isContentEditable) {
19570
- selectionChange(clientId);
19571
- }
19572
 
19573
- return;
19574
- } // If an inner block is focussed, that block is resposible for
19575
- // setting the selected block.
 
 
 
19576
 
19577
 
19578
- if (!isInsideRootBlock(node, event.target)) {
19579
- return;
19580
- }
 
 
 
19581
 
19582
- selectBlock(clientId);
19583
- }
19584
 
19585
- node.addEventListener('focusin', onFocus);
19586
- return () => {
19587
- node.removeEventListener('focusin', onFocus);
19588
- };
19589
- }, [isBlockSelected, selectBlock]);
19590
- }
19591
- //# sourceMappingURL=use-focus-handler.js.map
19592
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js
19593
  /**
19594
- * WordPress dependencies
19595
  */
19596
 
19597
 
 
 
 
 
 
 
 
19598
 
19599
 
 
 
 
 
19600
  /**
19601
- * Internal dependencies
19602
  */
19603
 
19604
 
 
 
 
19605
  /**
19606
- * Adds block behaviour:
19607
- * - Removes the block on BACKSPACE.
19608
- * - Inserts a default block on ENTER.
19609
- * - Disables dragging of block contents.
19610
- *
19611
- * @param {string} clientId Block client ID.
19612
  */
19613
 
19614
- function useEventHandlers(clientId) {
19615
- const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isBlockSelected(clientId), [clientId]);
19616
- const {
19617
- getBlockRootClientId,
19618
- getBlockIndex
19619
- } = (0,external_wp_data_namespaceObject.useSelect)(store);
19620
- const {
19621
- insertDefaultBlock,
19622
- removeBlock
19623
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
19624
- return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
19625
- if (!isSelected) {
19626
- return;
19627
- }
19628
- /**
19629
- * Interprets keydown event intent to remove or insert after block if
19630
- * key event occurs on wrapper node. This can occur when the block has
19631
- * no text fields of its own, particularly after initial insertion, to
19632
- * allow for easy deletion and continuous writing flow to add additional
19633
- * content.
19634
- *
19635
- * @param {KeyboardEvent} event Keydown event.
19636
- */
19637
 
 
 
 
 
 
 
19638
 
19639
- function onKeyDown(event) {
19640
- const {
19641
- keyCode,
19642
- target
19643
- } = event;
19644
 
19645
- if (keyCode !== external_wp_keycodes_namespaceObject.ENTER && keyCode !== external_wp_keycodes_namespaceObject.BACKSPACE && keyCode !== external_wp_keycodes_namespaceObject.DELETE) {
19646
- return;
19647
- }
 
 
 
19648
 
19649
- if (target !== node || (0,external_wp_dom_namespaceObject.isTextField)(target)) {
19650
- return;
19651
- }
19652
 
19653
- event.preventDefault();
 
 
19654
 
19655
- if (keyCode === external_wp_keycodes_namespaceObject.ENTER) {
19656
- insertDefaultBlock({}, getBlockRootClientId(clientId), getBlockIndex(clientId) + 1);
19657
- } else {
19658
- removeBlock(clientId);
19659
- }
19660
- }
19661
- /**
19662
- * Prevents default dragging behavior within a block. To do: we must
19663
- * handle this in the future and clean up the drag target.
19664
- *
19665
- * @param {DragEvent} event Drag event.
19666
- */
19667
 
 
 
 
 
 
 
 
19668
 
19669
- function onDragStart(event) {
19670
- event.preventDefault();
19671
- }
19672
 
19673
- node.addEventListener('keydown', onKeyDown);
19674
- node.addEventListener('dragstart', onDragStart);
19675
- return () => {
19676
- node.removeEventListener('keydown', onKeyDown);
19677
- node.removeEventListener('dragstart', onDragStart);
19678
- };
19679
- }, [clientId, isSelected, getBlockRootClientId, getBlockIndex, insertDefaultBlock, removeBlock]);
19680
- }
19681
- //# sourceMappingURL=use-selected-block-event-handlers.js.map
19682
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-nav-mode-exit.js
19683
  /**
19684
- * WordPress dependencies
19685
  */
19686
 
19687
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19688
  /**
19689
  * Internal dependencies
19690
  */
19691
 
19692
 
19693
  /**
19694
- * Allows navigation mode to be exited by clicking in the selected block.
19695
  *
19696
- * @param {string} clientId Block client ID.
 
 
 
 
 
 
 
19697
  */
19698
 
19699
- function useNavModeExit(clientId) {
19700
- const {
19701
- isNavigationMode,
19702
- isBlockSelected
19703
- } = (0,external_wp_data_namespaceObject.useSelect)(store);
19704
- const {
19705
- setNavigationMode,
19706
- selectBlock
19707
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
19708
- return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
19709
- function onMouseDown(event) {
19710
- // Don't select a block if it's already handled by a child
19711
- // block.
19712
- if (isNavigationMode() && !event.defaultPrevented) {
19713
- // Prevent focus from moving to the block.
19714
- event.preventDefault(); // When clicking on a selected block, exit navigation mode.
19715
-
19716
- if (isBlockSelected(clientId)) {
19717
- setNavigationMode(false);
19718
- } else {
19719
- selectBlock(clientId);
19720
- }
19721
- }
19722
- }
19723
-
19724
- node.addEventListener('mousedown', onMouseDown);
19725
- return () => {
19726
- node.addEventListener('mousedown', onMouseDown);
19727
- };
19728
- }, [clientId, isNavigationMode, isBlockSelected, setNavigationMode]);
19729
  }
19730
- //# sourceMappingURL=use-nav-mode-exit.js.map
19731
- // EXTERNAL MODULE: ./node_modules/dom-scroll-into-view/lib/index.js
19732
- var dom_scroll_into_view_lib = __webpack_require__(4979);
19733
- var lib_default = /*#__PURE__*/__webpack_require__.n(dom_scroll_into_view_lib);
19734
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-scroll-into-view.js
19735
  /**
19736
  * External dependencies
19737
  */
19738
 
19739
  /**
19740
- * WordPress dependencies
19741
  */
19742
 
19743
- /**
19744
- * WordPress dependencies
19745
- */
19746
 
19747
 
 
 
 
 
 
 
 
19748
 
 
 
 
 
 
 
 
 
 
 
19749
 
 
 
 
19750
  /**
19751
- * Internal dependencies
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19752
  */
19753
 
19754
 
19755
- function useScrollIntoView(clientId) {
19756
- const ref = (0,external_wp_element_namespaceObject.useRef)();
19757
- const isSelectionEnd = (0,external_wp_data_namespaceObject.useSelect)(select => {
19758
- const {
19759
- isBlockSelected,
19760
- getBlockSelectionEnd
19761
- } = select(store);
19762
- return isBlockSelected(clientId) || getBlockSelectionEnd() === clientId;
19763
- }, [clientId]); // Note that we can't use `useRefEffect` here, since an element change does
19764
- // not mean we can scroll. `isSelectionEnd` should be the sole dependency,
19765
- // while with `useRefEffect`, the element is a dependency as well.
19766
-
19767
- (0,external_wp_element_namespaceObject.useEffect)(() => {
19768
- if (!isSelectionEnd) {
19769
- return;
19770
- }
19771
-
19772
- const extentNode = ref.current;
19773
 
19774
- if (!extentNode) {
19775
- return;
19776
- } // If the block is focused, the browser will already have scrolled into
19777
- // view if necessary.
19778
 
 
 
 
 
 
19779
 
19780
- if (extentNode.contains(extentNode.ownerDocument.activeElement)) {
19781
- return;
19782
- }
19783
 
19784
- const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(extentNode) || extentNode.ownerDocument.defaultView; // If there's no scroll container, it follows that there's no scrollbar
19785
- // and thus there's no need to try to scroll into view.
19786
 
19787
- if (!scrollContainer) {
19788
- return;
19789
- }
19790
 
19791
- lib_default()(extentNode, scrollContainer, {
19792
- onlyScrollIfNeeded: true
19793
- });
19794
- }, [isSelectionEnd]);
19795
- return ref;
19796
  }
19797
- //# sourceMappingURL=use-scroll-into-view.js.map
19798
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-multi-selection.js
19799
  /**
19800
- * WordPress dependencies
 
 
 
 
 
19801
  */
19802
 
19803
 
 
 
 
19804
  /**
19805
- * Internal dependencies
 
 
 
 
19806
  */
19807
 
19808
 
19809
-
19810
-
19811
- function toggleRichText(container, toggle) {
19812
- Array.from(container.closest('.is-root-container').querySelectorAll('.rich-text')).forEach(node => {
19813
- if (toggle) {
19814
- node.setAttribute('contenteditable', true);
19815
- } else {
19816
- node.removeAttribute('contenteditable');
19817
- }
19818
  });
19819
  }
19820
  /**
19821
- * Sets a multi-selection based on the native selection across blocks.
19822
  *
19823
- * @param {string} clientId Block client ID.
 
 
19824
  */
19825
 
19826
 
19827
- function useMultiSelection(clientId) {
19828
- const {
19829
- startMultiSelect,
19830
- stopMultiSelect,
19831
- multiSelect,
19832
- selectBlock
19833
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
19834
- const {
19835
- isSelectionEnabled,
19836
- isBlockSelected,
19837
- getBlockParents,
19838
- getBlockSelectionStart,
19839
- hasMultiSelection
19840
- } = (0,external_wp_data_namespaceObject.useSelect)(store);
19841
- return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
19842
- const {
19843
- ownerDocument
19844
- } = node;
19845
- const {
19846
- defaultView
19847
- } = ownerDocument;
19848
- let anchorElement;
19849
- let rafId;
19850
-
19851
- function onSelectionChange({
19852
- isSelectionEnd
19853
- }) {
19854
- const selection = defaultView.getSelection(); // If no selection is found, end multi selection and enable all rich
19855
- // text areas.
19856
-
19857
- if (!selection.rangeCount || selection.isCollapsed) {
19858
- toggleRichText(node, true);
19859
- return;
19860
- }
19861
-
19862
- const endClientId = getBlockClientId(selection.focusNode);
19863
- const isSingularSelection = clientId === endClientId;
19864
-
19865
- if (isSingularSelection) {
19866
- selectBlock(clientId); // If the selection is complete (on mouse up), and no
19867
- // multiple blocks have been selected, set focus back to the
19868
- // anchor element. if the anchor element contains the
19869
- // selection. Additionally, rich text elements that were
19870
- // previously disabled can now be enabled again.
19871
-
19872
- if (isSelectionEnd) {
19873
- toggleRichText(node, true);
19874
 
19875
- if (selection.rangeCount) {
19876
- const {
19877
- commonAncestorContainer
19878
- } = selection.getRangeAt(0);
 
 
 
 
19879
 
19880
- if (anchorElement.contains(commonAncestorContainer)) {
19881
- anchorElement.focus();
19882
- }
19883
- }
19884
- }
19885
- } else {
19886
- const startPath = [...getBlockParents(clientId), clientId];
19887
- const endPath = [...getBlockParents(endClientId), endClientId];
19888
- const depth = Math.min(startPath.length, endPath.length) - 1;
19889
- multiSelect(startPath[depth], endPath[depth]);
19890
- }
19891
  }
 
19892
 
19893
- function onSelectionEnd() {
19894
- ownerDocument.removeEventListener('selectionchange', onSelectionChange); // Equivalent to attaching the listener once.
 
 
 
 
 
 
 
 
19895
 
19896
- defaultView.removeEventListener('mouseup', onSelectionEnd); // The browser selection won't have updated yet at this point,
19897
- // so wait until the next animation frame to get the browser
19898
- // selection.
19899
 
19900
- rafId = defaultView.requestAnimationFrame(() => {
19901
- onSelectionChange({
19902
- isSelectionEnd: true
19903
- });
19904
- stopMultiSelect();
19905
- });
19906
- }
19907
 
19908
- function onMouseLeave({
19909
- buttons
19910
- }) {
19911
- // The primary button must be pressed to initiate selection.
19912
- // See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons
19913
- if (buttons !== 1) {
19914
- return;
19915
- }
19916
 
19917
- if (!isSelectionEnabled() || !isBlockSelected(clientId)) {
19918
- return;
19919
- }
19920
 
19921
- anchorElement = ownerDocument.activeElement;
19922
- startMultiSelect(); // `onSelectionStart` is called after `mousedown` and
19923
- // `mouseleave` (from a block). The selection ends when
19924
- // `mouseup` happens anywhere in the window.
 
 
 
 
 
 
 
 
 
 
 
 
19925
 
19926
- ownerDocument.addEventListener('selectionchange', onSelectionChange);
19927
- defaultView.addEventListener('mouseup', onSelectionEnd); // Removing the contenteditable attributes within the block
19928
- // editor is essential for selection to work across editable
19929
- // areas. The edible hosts are removed, allowing selection to be
19930
- // extended outside the DOM element. `startMultiSelect` sets a
19931
- // flag in the store so the rich text components are updated,
19932
- // but the rerender may happen very slowly, especially in Safari
19933
- // for the blocks that are asynchonously rendered. To ensure the
19934
- // browser instantly removes the selection boundaries, we remove
19935
- // the contenteditable attributes manually.
 
 
19936
 
19937
- toggleRichText(node, false);
19938
- }
19939
 
19940
- function onMouseDown(event) {
19941
- // The main button.
19942
- // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
19943
- if (!isSelectionEnabled() || event.button !== 0) {
19944
- return;
19945
  }
 
19946
 
19947
- if (event.shiftKey) {
19948
- const blockSelectionStart = getBlockSelectionStart(); // Handle the case where we select a single block by
19949
- // holding the `shiftKey` and don't mark this action
19950
- // as multiselection.
19951
-
19952
- if (blockSelectionStart && blockSelectionStart !== clientId) {
19953
- toggleRichText(node, false);
19954
- multiSelect(blockSelectionStart, clientId);
19955
- event.preventDefault();
19956
- }
19957
- } else if (hasMultiSelection()) {
19958
- // Allow user to escape out of a multi-selection to a
19959
- // singular selection of a block via click. This is handled
19960
- // here since focus handling excludes blocks when there is
19961
- // multiselection, as focus can be incurred by starting a
19962
- // multiselection (focus moved to first block's multi-
19963
- // controls).
19964
- selectBlock(clientId);
19965
- }
19966
- }
19967
 
19968
- node.addEventListener('mousedown', onMouseDown);
19969
- node.addEventListener('mouseleave', onMouseLeave);
19970
- return () => {
19971
- node.removeEventListener('mousedown', onMouseDown);
19972
- node.removeEventListener('mouseleave', onMouseLeave);
19973
- ownerDocument.removeEventListener('selectionchange', onSelectionChange);
19974
- defaultView.removeEventListener('mouseup', onSelectionEnd);
19975
- defaultView.cancelAnimationFrame(rafId);
19976
  };
19977
- }, [clientId, startMultiSelect, stopMultiSelect, multiSelect, selectBlock, isSelectionEnabled, isBlockSelected, getBlockParents]);
19978
- }
19979
- //# sourceMappingURL=use-multi-selection.js.map
19980
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-intersection-observer.js
19981
- /**
19982
- * WordPress dependencies
19983
- */
19984
-
19985
-
19986
- /**
19987
- * Internal dependencies
19988
- */
19989
 
 
 
19990
 
19991
- function useIntersectionObserver() {
19992
- const observer = (0,external_wp_element_namespaceObject.useContext)(IntersectionObserver);
19993
- return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
19994
- if (observer) {
19995
- observer.observe(node);
19996
- return () => {
19997
- observer.unobserve(node);
19998
- };
19999
- }
20000
- }, [observer]);
20001
- }
20002
- //# sourceMappingURL=use-intersection-observer.js.map
20003
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/index.js
20004
  /**
20005
  * External dependencies
20006
  */
@@ -20010,11 +19189,6 @@ function useIntersectionObserver() {
20010
  */
20011
 
20012
 
20013
-
20014
-
20015
-
20016
-
20017
-
20018
  /**
20019
  * Internal dependencies
20020
  */
@@ -20022,139 +19196,113 @@ function useIntersectionObserver() {
20022
 
20023
 
20024
 
 
 
 
 
 
 
 
20025
 
 
 
 
 
 
 
 
20026
 
 
 
 
20027
 
 
 
 
20028
 
 
 
 
20029
 
 
 
 
20030
 
 
 
 
20031
 
20032
 
20033
-
20034
-
20035
-
20036
 
20037
 
20038
 
20039
  /**
20040
- * If the block count exceeds the threshold, we disable the reordering animation
20041
- * to avoid laginess.
20042
  */
20043
 
20044
- const BLOCK_ANIMATION_THRESHOLD = 200;
20045
  /**
20046
- * This hook is used to lightly mark an element as a block element. The element
20047
- * should be the outermost element of a block. Call this hook and pass the
20048
- * returned props to the element to mark as a block. If you define a ref for the
20049
- * element, it is important to pass the ref to this hook, which the hook in turn
20050
- * will pass to the component through the props it returns. Optionally, you can
20051
- * also pass any other props through this hook, and they will be merged and
20052
- * returned.
20053
- *
20054
- * @param {Object} props Optional. Props to pass to the element. Must contain
20055
- * the ref if one is defined.
20056
- * @param {Object} options Options for internal use only.
20057
- * @param {boolean} options.__unstableIsHtml
20058
- *
20059
- * @return {Object} Props to pass to the element to mark as a block.
20060
  */
20061
 
20062
- function useBlockProps(props = {}, {
20063
- __unstableIsHtml
20064
- } = {}) {
20065
- const {
20066
- clientId,
20067
- className,
20068
- wrapperProps = {},
20069
- isAligned
20070
- } = (0,external_wp_element_namespaceObject.useContext)(BlockListBlockContext);
20071
- const {
20072
- index,
20073
- mode,
20074
- name,
20075
- blockApiVersion,
20076
- blockTitle,
20077
- isPartOfSelection,
20078
- adjustScrolling,
20079
- enableAnimation
20080
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
20081
- const {
20082
- getBlockRootClientId,
20083
- getBlockIndex,
20084
- getBlockMode,
20085
- getBlockName,
20086
- isTyping,
20087
- getGlobalBlockCount,
20088
- isBlockSelected,
20089
- isBlockMultiSelected,
20090
- isAncestorMultiSelected,
20091
- isFirstMultiSelectedBlock
20092
- } = select(store);
20093
- const isSelected = isBlockSelected(clientId);
20094
- const isPartOfMultiSelection = isBlockMultiSelected(clientId) || isAncestorMultiSelected(clientId);
20095
- const blockName = getBlockName(clientId);
20096
- const rootClientId = getBlockRootClientId(clientId);
20097
- const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName);
20098
- return {
20099
- index: getBlockIndex(clientId, rootClientId),
20100
- mode: getBlockMode(clientId),
20101
- name: blockName,
20102
- blockApiVersion: (blockType === null || blockType === void 0 ? void 0 : blockType.apiVersion) || 1,
20103
- blockTitle: blockType === null || blockType === void 0 ? void 0 : blockType.title,
20104
- isPartOfSelection: isSelected || isPartOfMultiSelection,
20105
- adjustScrolling: isSelected || isFirstMultiSelectedBlock(clientId),
20106
- enableAnimation: !isTyping() && getGlobalBlockCount() <= BLOCK_ANIMATION_THRESHOLD
20107
- };
20108
- }, [clientId]); // translators: %s: Type of block (i.e. Text, Image etc)
20109
 
20110
- const blockLabel = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Block: %s'), blockTitle);
20111
- const htmlSuffix = mode === 'html' && !__unstableIsHtml ? '-visual' : '';
20112
- const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([props.ref, useFocusFirstElement(clientId), // Must happen after focus because we check for focus in the block.
20113
- useScrollIntoView(clientId), useBlockRefProvider(clientId), useFocusHandler(clientId), useMultiSelection(clientId), useEventHandlers(clientId), useNavModeExit(clientId), useIsHovered(), useIntersectionObserver(), use_moving_animation({
20114
- isSelected: isPartOfSelection,
20115
- adjustScrolling,
20116
- enableAnimation,
20117
- triggerAnimationOnChange: index
20118
- })]);
20119
- const blockEditContext = useBlockEditContext(); // Ensures it warns only inside the `edit` implementation for the block.
20120
 
20121
- if (blockApiVersion < 2 && clientId === blockEditContext.clientId) {
20122
- typeof process !== "undefined" && process.env && "production" !== "production" ? external_wp_warning_default()(`Block type "${name}" must support API version 2 or higher to work correctly with "useBlockProps" method.`) : void 0;
20123
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20124
 
20125
- return { ...wrapperProps,
20126
- ...props,
20127
- ref: mergedRefs,
20128
- id: `block-${clientId}${htmlSuffix}`,
20129
- tabIndex: 0,
20130
- role: 'document',
20131
- 'aria-label': blockLabel,
20132
- 'data-block': clientId,
20133
- 'data-type': name,
20134
- 'data-title': blockTitle,
20135
- className: classnames_default()( // The wp-block className is important for editor styles.
20136
- classnames_default()('block-editor-block-list__block', {
20137
- 'wp-block': !isAligned
20138
- }), className, props.className, wrapperProps.className, useBlockClassNames(clientId), useBlockDefaultClassName(clientId), useBlockCustomClassName(clientId), useBlockMovingModeClassNames(clientId)),
20139
- style: { ...wrapperProps.style,
20140
- ...props.style
20141
  }
20142
- };
20143
  }
20144
- /**
20145
- * Call within a save function to get the props for the block wrapper.
20146
- *
20147
- * @param {Object} props Optional. Props to pass to the element.
20148
- */
20149
 
20150
- useBlockProps.save = external_wp_blocks_namespaceObject.__unstableGetBlockProps;
 
 
 
 
 
 
 
 
 
20151
  //# sourceMappingURL=index.js.map
20152
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/block.js
20153
-
20154
-
20155
- /**
20156
- * External dependencies
20157
- */
20158
 
20159
 
20160
  /**
@@ -20163,10 +19311,6 @@ useBlockProps.save = external_wp_blocks_namespaceObject.__unstableGetBlockProps;
20163
 
20164
 
20165
 
20166
-
20167
-
20168
-
20169
-
20170
  /**
20171
  * Internal dependencies
20172
  */
@@ -20174,348 +19318,259 @@ useBlockProps.save = external_wp_blocks_namespaceObject.__unstableGetBlockProps;
20174
 
20175
 
20176
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20178
 
 
 
 
20179
 
20180
 
20181
- const BlockListBlockContext = (0,external_wp_element_namespaceObject.createContext)();
20182
  /**
20183
- * Merges wrapper props with special handling for classNames and styles.
20184
- *
20185
- * @param {Object} propsA
20186
- * @param {Object} propsB
20187
- *
20188
- * @return {Object} Merged props.
20189
  */
20190
 
20191
- function mergeWrapperProps(propsA, propsB) {
20192
- const newProps = { ...propsA,
20193
- ...propsB
20194
- };
20195
-
20196
- if (propsA && propsB && propsA.className && propsB.className) {
20197
- newProps.className = classnames_default()(propsA.className, propsB.className);
20198
- }
20199
-
20200
- if (propsA && propsB && propsA.style && propsB.style) {
20201
- newProps.style = { ...propsA.style,
20202
- ...propsB.style
20203
- };
20204
- }
20205
 
20206
- return newProps;
20207
- }
20208
 
20209
- function Block({
20210
- children,
20211
- isHtml,
20212
- ...props
20213
- }) {
20214
- return (0,external_wp_element_namespaceObject.createElement)("div", useBlockProps(props, {
20215
- __unstableIsHtml: isHtml
20216
- }), children);
20217
- }
20218
 
20219
- function BlockListBlock({
20220
- mode,
20221
- isLocked,
20222
- canRemove,
20223
- clientId,
20224
- isSelected,
20225
- isSelectionEnabled,
20226
- className,
20227
- name,
20228
- isValid,
20229
- attributes,
20230
- wrapperProps,
20231
- setAttributes,
20232
- onReplace,
20233
- onInsertBlocksAfter,
20234
- onMerge,
20235
- toggleSelection
20236
- }) {
20237
- const {
20238
- removeBlock
20239
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
20240
- const onRemove = (0,external_wp_element_namespaceObject.useCallback)(() => removeBlock(clientId), [clientId]); // We wrap the BlockEdit component in a div that hides it when editing in
20241
- // HTML mode. This allows us to render all of the ancillary pieces
20242
- // (InspectorControls, etc.) which are inside `BlockEdit` but not
20243
- // `BlockHTML`, even in HTML mode.
20244
 
20245
- let blockEdit = (0,external_wp_element_namespaceObject.createElement)(BlockEdit, {
20246
- name: name,
20247
- isSelected: isSelected,
20248
- attributes: attributes,
20249
- setAttributes: setAttributes,
20250
- insertBlocksAfter: isLocked ? undefined : onInsertBlocksAfter,
20251
- onReplace: canRemove ? onReplace : undefined,
20252
- onRemove: canRemove ? onRemove : undefined,
20253
- mergeBlocks: canRemove ? onMerge : undefined,
20254
- clientId: clientId,
20255
- isSelectionEnabled: isSelectionEnabled,
20256
- toggleSelection: toggleSelection
20257
- });
20258
- const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); // Determine whether the block has props to apply to the wrapper.
20259
 
20260
- if (blockType !== null && blockType !== void 0 && blockType.getEditWrapperProps) {
20261
- wrapperProps = mergeWrapperProps(wrapperProps, blockType.getEditWrapperProps(attributes));
20262
- }
20263
 
20264
- const isAligned = wrapperProps && !!wrapperProps['data-align']; // For aligned blocks, provide a wrapper element so the block can be
20265
- // positioned relative to the block column.
20266
 
20267
- if (isAligned) {
20268
- blockEdit = (0,external_wp_element_namespaceObject.createElement)("div", {
20269
- className: "wp-block",
20270
- "data-align": wrapperProps['data-align']
20271
- }, blockEdit);
20272
- }
20273
 
20274
- let block;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20275
 
20276
- if (!isValid) {
20277
- const saveContent = (0,external_wp_blocks_namespaceObject.getSaveContent)(blockType, attributes);
20278
- block = (0,external_wp_element_namespaceObject.createElement)(Block, {
20279
- className: "has-warning"
20280
- }, (0,external_wp_element_namespaceObject.createElement)(block_invalid_warning, {
20281
- clientId: clientId
20282
- }), (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, (0,external_wp_dom_namespaceObject.safeHTML)(saveContent)));
20283
- } else if (mode === 'html') {
20284
- // Render blockEdit so the inspector controls don't disappear.
20285
- // See #8969.
20286
- block = (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
20287
- style: {
20288
- display: 'none'
20289
- }
20290
- }, blockEdit), (0,external_wp_element_namespaceObject.createElement)(Block, {
20291
- isHtml: true
20292
- }, (0,external_wp_element_namespaceObject.createElement)(block_html, {
20293
- clientId: clientId
20294
- })));
20295
- } else if ((blockType === null || blockType === void 0 ? void 0 : blockType.apiVersion) > 1) {
20296
- block = blockEdit;
20297
- } else {
20298
- block = (0,external_wp_element_namespaceObject.createElement)(Block, wrapperProps, blockEdit);
20299
  }
20300
 
20301
- const value = {
20302
- clientId,
20303
- className,
20304
- wrapperProps: (0,external_lodash_namespaceObject.omit)(wrapperProps, ['data-align']),
20305
- isAligned
20306
- };
20307
- const memoizedValue = (0,external_wp_element_namespaceObject.useMemo)(() => value, Object.values(value));
20308
- return (0,external_wp_element_namespaceObject.createElement)(BlockListBlockContext.Provider, {
20309
- value: memoizedValue
20310
- }, (0,external_wp_element_namespaceObject.createElement)(block_crash_boundary, {
20311
- fallback: (0,external_wp_element_namespaceObject.createElement)(Block, {
20312
- className: "has-warning"
20313
- }, (0,external_wp_element_namespaceObject.createElement)(block_crash_warning, null))
20314
- }, block));
20315
  }
 
 
 
 
 
 
 
 
 
 
 
20316
 
20317
- const applyWithSelect = (0,external_wp_data_namespaceObject.withSelect)((select, {
20318
- clientId,
20319
- rootClientId
20320
- }) => {
20321
- const {
20322
- isBlockSelected,
20323
- getBlockMode,
20324
- isSelectionEnabled,
20325
- getTemplateLock,
20326
- __unstableGetBlockWithoutInnerBlocks,
20327
- canRemoveBlock,
20328
- canMoveBlock
20329
- } = select(store);
20330
-
20331
- const block = __unstableGetBlockWithoutInnerBlocks(clientId);
20332
-
20333
- const isSelected = isBlockSelected(clientId);
20334
- const templateLock = getTemplateLock(rootClientId);
20335
- const canRemove = canRemoveBlock(clientId, rootClientId);
20336
- const canMove = canMoveBlock(clientId, rootClientId); // The fallback to `{}` is a temporary fix.
20337
- // This function should never be called when a block is not present in
20338
- // the state. It happens now because the order in withSelect rendering
20339
- // is not correct.
20340
-
20341
- const {
20342
- name,
20343
- attributes,
20344
- isValid
20345
- } = block || {}; // Do not add new properties here, use `useSelect` instead to avoid
20346
- // leaking new props to the public API (editor.BlockListBlock filter).
20347
 
20348
- return {
20349
- mode: getBlockMode(clientId),
20350
- isSelectionEnabled: isSelectionEnabled(),
20351
- isLocked: !!templateLock,
20352
- canRemove,
20353
- canMove,
20354
- // Users of the editor.BlockListBlock filter used to be able to
20355
- // access the block prop.
20356
- // Ideally these blocks would rely on the clientId prop only.
20357
- // This is kept for backward compatibility reasons.
20358
- block,
20359
- name,
20360
- attributes,
20361
- isValid,
20362
- isSelected
20363
- };
20364
- });
20365
- const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps, {
20366
- select
20367
- }) => {
20368
- const {
20369
- updateBlockAttributes,
20370
- insertBlocks,
20371
- mergeBlocks,
20372
- replaceBlocks,
20373
- toggleSelection,
20374
- __unstableMarkLastChangeAsPersistent
20375
- } = dispatch(store); // Do not add new properties here, use `useDispatch` instead to avoid
20376
- // leaking new props to the public API (editor.BlockListBlock filter).
20377
 
20378
- return {
20379
- setAttributes(newAttributes) {
20380
- const {
20381
- getMultiSelectedBlockClientIds
20382
- } = select(store);
20383
- const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds();
20384
- const {
20385
- clientId
20386
- } = ownProps;
20387
- const clientIds = multiSelectedBlockClientIds.length ? multiSelectedBlockClientIds : [clientId];
20388
- updateBlockAttributes(clientIds, newAttributes);
20389
- },
20390
 
20391
- onInsertBlocks(blocks, index) {
20392
- const {
20393
- rootClientId
20394
- } = ownProps;
20395
- insertBlocks(blocks, index, rootClientId);
20396
- },
20397
 
20398
- onInsertBlocksAfter(blocks) {
20399
- const {
20400
- clientId,
20401
- rootClientId
20402
- } = ownProps;
20403
- const {
20404
- getBlockIndex
20405
- } = select(store);
20406
- const index = getBlockIndex(clientId, rootClientId);
20407
- insertBlocks(blocks, index + 1, rootClientId);
20408
- },
20409
 
20410
- onMerge(forward) {
20411
- const {
20412
- clientId
20413
- } = ownProps;
20414
- const {
20415
- getPreviousBlockClientId,
20416
- getNextBlockClientId
20417
- } = select(store);
20418
 
20419
- if (forward) {
20420
- const nextBlockClientId = getNextBlockClientId(clientId);
20421
 
20422
- if (nextBlockClientId) {
20423
- mergeBlocks(clientId, nextBlockClientId);
20424
- }
20425
- } else {
20426
- const previousBlockClientId = getPreviousBlockClientId(clientId);
20427
 
20428
- if (previousBlockClientId) {
20429
- mergeBlocks(previousBlockClientId, clientId);
20430
- }
20431
- }
20432
- },
20433
 
20434
- onReplace(blocks, indexToSelect, initialPosition) {
20435
- if (blocks.length && !(0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blocks[blocks.length - 1])) {
20436
- __unstableMarkLastChangeAsPersistent();
20437
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20438
 
20439
- replaceBlocks([ownProps.clientId], blocks, indexToSelect, initialPosition);
20440
- },
 
 
 
 
20441
 
20442
- toggleSelection(selectionEnabled) {
20443
- toggleSelection(selectionEnabled);
20444
- }
 
20445
 
20446
- };
20447
- });
20448
- /* harmony default export */ var block = ((0,external_wp_compose_namespaceObject.compose)(external_wp_compose_namespaceObject.pure, applyWithSelect, applyWithDispatch, // block is sometimes not mounted at the right time, causing it be undefined
20449
- // see issue for more info
20450
- // https://github.com/WordPress/gutenberg/issues/17013
20451
- (0,external_wp_compose_namespaceObject.ifCondition)(({
20452
- block
20453
- }) => !!block), (0,external_wp_components_namespaceObject.withFilters)('editor.BlockListBlock'))(BlockListBlock));
20454
- //# sourceMappingURL=block.js.map
20455
- ;// CONCATENATED MODULE: external ["wp","htmlEntities"]
20456
- var external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
20457
- ;// CONCATENATED MODULE: ./packages/icons/build-module/library/plus.js
20458
 
20459
 
20460
  /**
20461
  * WordPress dependencies
20462
  */
20463
 
20464
- const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
20465
- xmlns: "http://www.w3.org/2000/svg",
20466
- viewBox: "0 0 24 24"
20467
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
20468
- d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"
20469
- }));
20470
- /* harmony default export */ var library_plus = (plus);
20471
- //# sourceMappingURL=plus.js.map
20472
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/tips.js
20473
-
20474
 
20475
  /**
20476
- * WordPress dependencies
20477
  */
20478
 
20479
 
20480
 
20481
- const globalTips = [(0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('While writing, you can press <kbd>/</kbd> to quickly insert new blocks.'), {
20482
- kbd: (0,external_wp_element_namespaceObject.createElement)("kbd", null)
20483
- }), (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Indent a list by pressing <kbd>space</kbd> at the beginning of a line.'), {
20484
- kbd: (0,external_wp_element_namespaceObject.createElement)("kbd", null)
20485
- }), (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Outdent a list by pressing <kbd>backspace</kbd> at the beginning of a line.'), {
20486
- kbd: (0,external_wp_element_namespaceObject.createElement)("kbd", null)
20487
- }), (0,external_wp_i18n_namespaceObject.__)('Drag files into the editor to automatically insert media blocks.'), (0,external_wp_i18n_namespaceObject.__)("Change a block's type by pressing the block icon on the toolbar.")];
 
 
 
 
 
 
 
 
 
 
 
 
20488
 
20489
- function Tips() {
20490
- const [randomIndex] = (0,external_wp_element_namespaceObject.useState)( // Disable Reason: I'm not generating an HTML id.
20491
- // eslint-disable-next-line no-restricted-syntax
20492
- Math.floor(Math.random() * globalTips.length));
20493
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Tip, null, globalTips[randomIndex]);
20494
- }
20495
 
20496
- /* harmony default export */ var tips = (Tips);
20497
- //# sourceMappingURL=tips.js.map
20498
- ;// CONCATENATED MODULE: ./packages/icons/build-module/library/block-default.js
 
 
 
 
 
 
 
 
20499
 
20500
 
20501
  /**
20502
  * WordPress dependencies
20503
  */
20504
 
20505
- const blockDefault = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
 
 
20506
  xmlns: "http://www.w3.org/2000/svg",
20507
- viewBox: "0 0 24 24"
20508
  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
20509
- d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"
20510
  }));
20511
- /* harmony default export */ var block_default = (blockDefault);
20512
- //# sourceMappingURL=block-default.js.map
20513
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-icon/index.js
20514
-
20515
 
20516
- /**
20517
- * External dependencies
20518
- */
20519
 
20520
  /**
20521
  * WordPress dependencies
@@ -20523,35 +19578,32 @@ const blockDefault = (0,external_wp_element_namespaceObject.createElement)(exter
20523
 
20524
 
20525
 
20526
- function BlockIcon({
20527
- icon,
20528
- showColors = false,
20529
- className
20530
- }) {
20531
- var _icon;
20532
 
20533
- if (((_icon = icon) === null || _icon === void 0 ? void 0 : _icon.src) === 'block-default') {
20534
- icon = {
20535
- src: block_default
20536
- };
20537
- }
20538
 
20539
- const renderedIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
20540
- icon: icon && icon.src ? icon.src : icon
20541
- });
20542
- const style = showColors ? {
20543
- backgroundColor: icon && icon.background,
20544
- color: icon && icon.foreground
20545
- } : {};
20546
- return (0,external_wp_element_namespaceObject.createElement)("span", {
20547
- style: style,
20548
- className: classnames_default()('block-editor-block-icon', className, {
20549
- 'has-colors': showColors
20550
- })
20551
- }, renderedIcon);
 
 
 
 
 
20552
  }
20553
- //# sourceMappingURL=index.js.map
20554
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-card/index.js
20555
 
20556
 
20557
  /**
@@ -20564,92 +19616,169 @@ function BlockIcon({
20564
 
20565
 
20566
 
20567
- function BlockCard({
20568
- title,
 
20569
  icon,
20570
- description,
20571
- blockType
20572
- }) {
20573
- if (blockType) {
20574
- external_wp_deprecated_default()('`blockType` property in `BlockCard component`', {
20575
- since: '5.7',
20576
- alternative: '`title, icon and description` properties'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20577
  });
20578
- ({
20579
- title,
20580
- icon,
20581
- description
20582
- } = blockType);
20583
- }
20584
-
20585
- return (0,external_wp_element_namespaceObject.createElement)("div", {
20586
- className: "block-editor-block-card"
20587
- }, (0,external_wp_element_namespaceObject.createElement)(BlockIcon, {
20588
- icon: icon,
20589
- showColors: true
20590
- }), (0,external_wp_element_namespaceObject.createElement)("div", {
20591
- className: "block-editor-block-card__content"
20592
- }, (0,external_wp_element_namespaceObject.createElement)("h2", {
20593
- className: "block-editor-block-card__title"
20594
- }, title), (0,external_wp_element_namespaceObject.createElement)("span", {
20595
- className: "block-editor-block-card__description"
20596
- }, description)));
20597
- }
20598
 
20599
- /* harmony default export */ var block_card = (BlockCard);
20600
  //# sourceMappingURL=index.js.map
20601
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/provider/with-registry-provider.js
20602
 
20603
 
20604
 
 
 
 
 
20605
  /**
20606
  * WordPress dependencies
20607
  */
20608
 
20609
 
20610
 
 
20611
  /**
20612
  * Internal dependencies
20613
  */
20614
 
20615
 
20616
 
20617
- const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => {
20618
- return (0,external_wp_data_namespaceObject.withRegistry)(({
20619
- useSubRegistry = true,
20620
- registry,
20621
- ...props
20622
- }) => {
20623
- if (!useSubRegistry) {
20624
- return (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, _extends({
20625
- registry: registry
20626
- }, props));
20627
- }
20628
 
20629
- const [subRegistry, setSubRegistry] = (0,external_wp_element_namespaceObject.useState)(null);
20630
- (0,external_wp_element_namespaceObject.useEffect)(() => {
20631
- const newRegistry = (0,external_wp_data_namespaceObject.createRegistry)({}, registry);
20632
- newRegistry.registerStore(STORE_NAME, storeConfig);
20633
- setSubRegistry(newRegistry);
20634
- }, [registry]);
 
20635
 
20636
- if (!subRegistry) {
20637
- return null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20638
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20639
 
20640
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_data_namespaceObject.RegistryProvider, {
20641
- value: subRegistry
20642
- }, (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, _extends({
20643
- registry: subRegistry
20644
- }, props)));
20645
- });
20646
- }, 'withRegistryProvider');
20647
- /* harmony default export */ var with_registry_provider = (withRegistryProvider);
20648
- //# sourceMappingURL=with-registry-provider.js.map
20649
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/provider/use-block-sync.js
20650
- /**
20651
- * External dependencies
20652
- */
20653
 
20654
  /**
20655
  * WordPress dependencies
@@ -20658,253 +19787,187 @@ const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigher
20658
 
20659
 
20660
 
20661
- /**
20662
- * Internal dependencies
20663
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20664
 
20665
 
20666
- /**
20667
- * A function to call when the block value has been updated in the block-editor
20668
- * store.
20669
- *
20670
- * @callback onBlockUpdate
20671
- * @param {Object[]} blocks The updated blocks.
20672
- * @param {Object} options The updated block options, such as selectionStart
20673
- * and selectionEnd.
20674
- */
20675
 
20676
  /**
20677
- * useBlockSync is a side effect which handles bidirectional sync between the
20678
- * block-editor store and a controlling data source which provides blocks. This
20679
- * is most commonly used by the BlockEditorProvider to synchronize the contents
20680
- * of the block-editor store with the root entity, like a post.
20681
- *
20682
- * Another example would be the template part block, which provides blocks from
20683
- * a separate entity data source than a root entity. This hook syncs edits to
20684
- * the template part in the block editor back to the entity and vice-versa.
20685
- *
20686
- * Here are some of its basic functions:
20687
- * - Initalizes the block-editor store for the given clientID to the blocks
20688
- * given via props.
20689
- * - Adds incoming changes (like undo) to the block-editor store.
20690
- * - Adds outgoing changes (like editing content) to the controlling entity,
20691
- * determining if a change should be considered persistent or not.
20692
- * - Handles edge cases and race conditions which occur in those operations.
20693
- * - Ignores changes which happen to other entities (like nested inner block
20694
- * controllers.
20695
- * - Passes selection state from the block-editor store to the controlling entity.
20696
- *
20697
- * @param {Object} props Props for the block sync hook
20698
- * @param {string} props.clientId The client ID of the inner block controller.
20699
- * If none is passed, then it is assumed to be a
20700
- * root controller rather than an inner block
20701
- * controller.
20702
- * @param {Object[]} props.value The control value for the blocks. This value
20703
- * is used to initalize the block-editor store
20704
- * and for resetting the blocks to incoming
20705
- * changes like undo.
20706
- * @param {Object} props.selection The selection state responsible to restore the selection on undo/redo.
20707
- * @param {onBlockUpdate} props.onChange Function to call when a persistent
20708
- * change has been made in the block-editor blocks
20709
- * for the given clientId. For example, after
20710
- * this function is called, an entity is marked
20711
- * dirty because it has changes to save.
20712
- * @param {onBlockUpdate} props.onInput Function to call when a non-persistent
20713
- * change has been made in the block-editor blocks
20714
- * for the given clientId. When this is called,
20715
- * controlling sources do not become dirty.
20716
  */
20717
 
20718
- function useBlockSync({
20719
- clientId = null,
20720
- value: controlledBlocks,
20721
- selection: controlledSelection,
20722
- onChange = external_lodash_namespaceObject.noop,
20723
- onInput = external_lodash_namespaceObject.noop
20724
- }) {
20725
- const registry = (0,external_wp_data_namespaceObject.useRegistry)();
20726
- const {
20727
- resetBlocks,
20728
- resetSelection,
20729
- replaceInnerBlocks,
20730
- setHasControlledInnerBlocks,
20731
- __unstableMarkNextChangeAsNotPersistent
20732
- } = registry.dispatch(store);
20733
- const {
20734
- getBlockName,
20735
- getBlocks
20736
- } = registry.select(store);
20737
- const pendingChanges = (0,external_wp_element_namespaceObject.useRef)({
20738
- incoming: null,
20739
- outgoing: []
20740
- });
20741
- const subscribed = (0,external_wp_element_namespaceObject.useRef)(false);
20742
 
20743
- const setControlledBlocks = () => {
20744
- if (!controlledBlocks) {
20745
- return;
20746
- } // We don't need to persist this change because we only replace
20747
- // controlled inner blocks when the change was caused by an entity,
20748
- // and so it would already be persisted.
20749
 
20750
 
20751
- __unstableMarkNextChangeAsNotPersistent();
20752
 
20753
- if (clientId) {
20754
- setHasControlledInnerBlocks(clientId, true);
 
 
 
 
 
 
20755
 
20756
- __unstableMarkNextChangeAsNotPersistent();
 
 
20757
 
20758
- const storeBlocks = controlledBlocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block));
20759
 
20760
- if (subscribed.current) {
20761
- pendingChanges.current.incoming = storeBlocks;
20762
- }
20763
 
20764
- replaceInnerBlocks(clientId, storeBlocks);
20765
- } else {
20766
- if (subscribed.current) {
20767
- pendingChanges.current.incoming = controlledBlocks;
20768
- }
20769
 
20770
- resetBlocks(controlledBlocks);
20771
- }
20772
- }; // Add a subscription to the block-editor registry to detect when changes
20773
- // have been made. This lets us inform the data source of changes. This
20774
- // is an effect so that the subscriber can run synchronously without
20775
- // waiting for React renders for changes.
20776
 
20777
 
20778
- const onInputRef = (0,external_wp_element_namespaceObject.useRef)(onInput);
20779
- const onChangeRef = (0,external_wp_element_namespaceObject.useRef)(onChange);
20780
- (0,external_wp_element_namespaceObject.useEffect)(() => {
20781
- onInputRef.current = onInput;
20782
- onChangeRef.current = onChange;
20783
- }, [onInput, onChange]); // Determine if blocks need to be reset when they change.
20784
 
20785
- (0,external_wp_element_namespaceObject.useEffect)(() => {
20786
- if (pendingChanges.current.outgoing.includes(controlledBlocks)) {
20787
- // Skip block reset if the value matches expected outbound sync
20788
- // triggered by this component by a preceding change detection.
20789
- // Only skip if the value matches expectation, since a reset should
20790
- // still occur if the value is modified (not equal by reference),
20791
- // to allow that the consumer may apply modifications to reflect
20792
- // back on the editor.
20793
- if ((0,external_lodash_namespaceObject.last)(pendingChanges.current.outgoing) === controlledBlocks) {
20794
- pendingChanges.current.outgoing = [];
20795
- }
20796
- } else if (getBlocks(clientId) !== controlledBlocks) {
20797
- // Reset changing value in all other cases than the sync described
20798
- // above. Since this can be reached in an update following an out-
20799
- // bound sync, unset the outbound value to avoid considering it in
20800
- // subsequent renders.
20801
- pendingChanges.current.outgoing = [];
20802
- setControlledBlocks();
20803
 
20804
- if (controlledSelection) {
20805
- resetSelection(controlledSelection.selectionStart, controlledSelection.selectionEnd, controlledSelection.initialPosition);
20806
- }
20807
- }
20808
- }, [controlledBlocks, clientId]);
20809
- (0,external_wp_element_namespaceObject.useEffect)(() => {
20810
- const {
20811
- getSelectionStart,
20812
- getSelectionEnd,
20813
- getSelectedBlocksInitialCaretPosition,
20814
- isLastBlockChangePersistent,
20815
- __unstableIsLastBlockChangeIgnored
20816
- } = registry.select(store);
20817
- let blocks = getBlocks(clientId);
20818
- let isPersistent = isLastBlockChangePersistent();
20819
- let previousAreBlocksDifferent = false;
20820
- subscribed.current = true;
20821
- const unsubscribe = registry.subscribe(() => {
20822
- // Sometimes, when changing block lists, lingering subscriptions
20823
- // might trigger before they are cleaned up. If the block for which
20824
- // the subscription runs is no longer in the store, this would clear
20825
- // its parent entity's block list. To avoid this, we bail out if
20826
- // the subscription is triggering for a block (`clientId !== null`)
20827
- // and its block name can't be found because it's not on the list.
20828
- // (`getBlockName( clientId ) === null`).
20829
- if (clientId !== null && getBlockName(clientId) === null) return;
20830
- const newIsPersistent = isLastBlockChangePersistent();
20831
- const newBlocks = getBlocks(clientId);
20832
- const areBlocksDifferent = newBlocks !== blocks;
20833
- blocks = newBlocks;
20834
 
20835
- if (areBlocksDifferent && (pendingChanges.current.incoming || __unstableIsLastBlockChangeIgnored())) {
20836
- pendingChanges.current.incoming = null;
20837
- isPersistent = newIsPersistent;
20838
- return;
20839
- } // Since we often dispatch an action to mark the previous action as
20840
- // persistent, we need to make sure that the blocks changed on the
20841
- // previous action before committing the change.
20842
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20843
 
20844
- const didPersistenceChange = previousAreBlocksDifferent && !areBlocksDifferent && newIsPersistent && !isPersistent;
 
 
20845
 
20846
- if (areBlocksDifferent || didPersistenceChange) {
20847
- isPersistent = newIsPersistent; // We know that onChange/onInput will update controlledBlocks.
20848
- // We need to be aware that it was caused by an outgoing change
20849
- // so that we do not treat it as an incoming change later on,
20850
- // which would cause a block reset.
20851
 
20852
- pendingChanges.current.outgoing.push(blocks); // Inform the controlling entity that changes have been made to
20853
- // the block-editor store they should be aware about.
 
20854
 
20855
- const updateParent = isPersistent ? onChangeRef.current : onInputRef.current;
20856
- updateParent(blocks, {
20857
- selection: {
20858
- selectionStart: getSelectionStart(),
20859
- selectionEnd: getSelectionEnd(),
20860
- initialPosition: getSelectedBlocksInitialCaretPosition()
20861
- }
20862
- });
20863
- }
20864
 
20865
- previousAreBlocksDifferent = areBlocksDifferent;
20866
- });
20867
- return () => unsubscribe();
20868
- }, [registry, clientId]);
 
 
 
 
 
 
 
 
 
 
20869
  }
20870
- //# sourceMappingURL=use-block-sync.js.map
20871
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/provider/index.js
20872
-
20873
 
 
 
 
20874
  /**
20875
  * WordPress dependencies
20876
  */
20877
 
20878
 
 
20879
  /**
20880
  * Internal dependencies
20881
  */
20882
 
20883
 
 
 
 
 
 
 
 
20884
 
20885
-
20886
-
20887
- /** @typedef {import('@wordpress/data').WPDataRegistry} WPDataRegistry */
20888
-
20889
- function BlockEditorProvider(props) {
20890
- const {
20891
- children,
20892
- settings
20893
- } = props;
20894
  const {
20895
- updateSettings
20896
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
20897
- (0,external_wp_element_namespaceObject.useEffect)(() => {
20898
- updateSettings(settings);
20899
- }, [settings]); // Syncs the entity provider with changes in the block-editor store.
20900
-
20901
- useBlockSync(props);
20902
- return (0,external_wp_element_namespaceObject.createElement)(BlockRefsProvider, null, children);
20903
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20904
 
20905
- /* harmony default export */ var provider = (with_registry_provider(BlockEditorProvider));
20906
- //# sourceMappingURL=index.js.map
20907
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-preview/live.js
20908
 
20909
 
20910
  /**
@@ -20916,74 +19979,159 @@ function BlockEditorProvider(props) {
20916
  */
20917
 
20918
 
20919
- function LiveBlockPreview({
20920
- onClick
 
 
 
 
20921
  }) {
20922
- return (0,external_wp_element_namespaceObject.createElement)("div", {
20923
- tabIndex: 0,
20924
- role: "button",
20925
- onClick: onClick,
20926
- onKeyPress: onClick
20927
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Disabled, null, (0,external_wp_element_namespaceObject.createElement)(BlockList, null)));
 
20928
  }
20929
- //# sourceMappingURL=live.js.map
20930
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-selection-clearer/index.js
 
 
20931
 
20932
 
 
 
 
20933
 
20934
  /**
20935
  * WordPress dependencies
20936
  */
20937
 
20938
 
 
 
20939
  /**
20940
  * Internal dependencies
20941
  */
20942
 
20943
 
 
 
 
 
 
 
 
20944
  /**
20945
- * Pass the returned ref callback to an element that should clear block
20946
- * selection. Selection will only be cleared if the element is clicked directly,
20947
- * not if a child element is clicked.
20948
  *
20949
- * @return {import('react').RefCallback} Ref callback.
20950
  */
20951
 
20952
- function useBlockSelectionClearer() {
20953
- const {
20954
- hasSelectedBlock,
20955
- hasMultiSelection
20956
- } = (0,external_wp_data_namespaceObject.useSelect)(store);
20957
- const {
20958
- clearSelectedBlock
20959
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
20960
- return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
20961
- function onMouseDown(event) {
20962
- if (!hasSelectedBlock() && !hasMultiSelection()) {
20963
- return;
20964
- } // Only handle clicks on the element, not the children.
20965
-
 
 
 
 
 
 
 
 
 
20966
 
20967
- if (event.target !== node) {
20968
- return;
20969
  }
 
 
 
20970
 
20971
- clearSelectedBlock();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20972
  }
20973
 
20974
- node.addEventListener('mousedown', onMouseDown);
20975
- return () => {
20976
- node.removeEventListener('mousedown', onMouseDown);
20977
- };
20978
- }, [hasSelectedBlock, hasMultiSelection, clearSelectedBlock]);
20979
- }
20980
- function BlockSelectionClearer(props) {
20981
- return (0,external_wp_element_namespaceObject.createElement)("div", _extends({
20982
- ref: useBlockSelectionClearer()
20983
- }, props));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20984
  }
20985
- //# sourceMappingURL=index.js.map
20986
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/writing-flow/use-multi-selection.js
 
 
 
20987
  /**
20988
  * External dependencies
20989
  */
@@ -20994,144 +20142,226 @@ function BlockSelectionClearer(props) {
20994
 
20995
 
20996
 
20997
- /**
20998
- * Internal dependencies
20999
- */
21000
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21001
 
 
 
 
 
 
 
21002
 
21003
 
21004
- function use_multi_selection_toggleRichText(container, toggle) {
21005
- Array.from(container.querySelectorAll('.rich-text')).forEach(node => {
21006
- if (toggle) {
21007
- node.setAttribute('contenteditable', true);
21008
- } else {
21009
- node.removeAttribute('contenteditable');
21010
  }
21011
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21012
  }
 
 
 
 
 
 
21013
  /**
21014
- * Returns for the deepest node at the start or end of a container node. Ignores
21015
- * any text nodes that only contain HTML formatting whitespace.
21016
- *
21017
- * @param {Element} node Container to search.
21018
- * @param {string} type 'start' or 'end'.
21019
  */
21020
 
 
 
 
21021
 
21022
- function getDeepestNode(node, type) {
21023
- const child = type === 'start' ? 'firstChild' : 'lastChild';
21024
- const sibling = type === 'start' ? 'nextSibling' : 'previousSibling';
21025
 
21026
- while (node[child]) {
21027
- node = node[child];
21028
 
21029
- while (node.nodeType === node.TEXT_NODE && /^[ \t\n]*$/.test(node.data) && node[sibling]) {
21030
- node = node[sibling];
21031
- }
21032
- }
21033
 
21034
- return node;
21035
- }
21036
 
21037
- function selector(select) {
21038
- const {
21039
- isMultiSelecting,
21040
- getMultiSelectedBlockClientIds,
21041
- hasMultiSelection,
21042
- getSelectedBlockClientId
21043
- } = select(store);
21044
- return {
21045
- isMultiSelecting: isMultiSelecting(),
21046
- multiSelectedBlockClientIds: getMultiSelectedBlockClientIds(),
21047
- hasMultiSelection: hasMultiSelection(),
21048
- selectedBlockClientId: getSelectedBlockClientId()
21049
- };
21050
- }
21051
 
21052
- function use_multi_selection_useMultiSelection() {
21053
- const {
21054
- isMultiSelecting,
21055
- multiSelectedBlockClientIds,
21056
- hasMultiSelection,
21057
- selectedBlockClientId
21058
- } = (0,external_wp_data_namespaceObject.useSelect)(selector, []);
21059
- const selectedRef = useBlockRef(selectedBlockClientId); // These must be in the right DOM order.
21060
 
21061
- const startRef = useBlockRef((0,external_lodash_namespaceObject.first)(multiSelectedBlockClientIds));
21062
- const endRef = useBlockRef((0,external_lodash_namespaceObject.last)(multiSelectedBlockClientIds));
21063
- /**
21064
- * When the component updates, and there is multi selection, we need to
21065
- * select the entire block contents.
21066
- */
21067
 
21068
- return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
21069
- const {
21070
- ownerDocument
21071
- } = node;
 
 
 
 
 
 
 
 
 
 
21072
  const {
21073
- defaultView
21074
- } = ownerDocument;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21075
 
21076
- if (!hasMultiSelection || isMultiSelecting) {
21077
- if (!selectedBlockClientId || isMultiSelecting) {
21078
- return;
21079
- }
21080
 
21081
- const selection = defaultView.getSelection();
21082
 
21083
- if (selection.rangeCount && !selection.isCollapsed) {
21084
- const blockNode = selectedRef.current;
21085
- const {
21086
- startContainer,
21087
- endContainer
21088
- } = selection.getRangeAt(0);
21089
 
21090
- if (!!blockNode && (!blockNode.contains(startContainer) || !blockNode.contains(endContainer))) {
21091
- selection.removeAllRanges();
21092
- }
21093
- }
21094
 
21095
- return;
21096
- }
21097
 
21098
- const {
21099
- length
21100
- } = multiSelectedBlockClientIds;
21101
 
21102
- if (length < 2) {
21103
- return;
21104
- } // The block refs might not be immediately available
21105
- // when dragging blocks into another block.
21106
 
21107
 
21108
- if (!startRef.current || !endRef.current) {
21109
- return;
21110
- } // For some browsers, like Safari, it is important that focus happens
21111
- // BEFORE selection.
21112
 
21113
 
21114
- node.focus();
21115
- const selection = defaultView.getSelection();
21116
- const range = ownerDocument.createRange(); // These must be in the right DOM order.
21117
- // The most stable way to select the whole block contents is to start
21118
- // and end at the deepest points.
21119
 
21120
- const startNode = getDeepestNode(startRef.current, 'start');
21121
- const endNode = getDeepestNode(endRef.current, 'end'); // While rich text will be disabled with a delay when there is a multi
21122
- // selection, we must do it immediately because it's not possible to set
21123
- // selection across editable hosts.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21124
 
21125
- use_multi_selection_toggleRichText(node, false);
21126
- range.setStartBefore(startNode);
21127
- range.setEndAfter(endNode);
21128
- selection.removeAllRanges();
21129
- selection.addRange(range);
21130
- }, [hasMultiSelection, isMultiSelecting, multiSelectedBlockClientIds, selectedBlockClientId]);
21131
- }
21132
- //# sourceMappingURL=use-multi-selection.js.map
21133
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/writing-flow/use-tab-nav.js
21134
 
 
 
 
21135
 
21136
  /**
21137
  * WordPress dependencies
@@ -21140,192 +20370,205 @@ function use_multi_selection_useMultiSelection() {
21140
 
21141
 
21142
 
21143
-
21144
  /**
21145
  * Internal dependencies
21146
  */
21147
 
21148
 
21149
 
21150
- function isFormElement(element) {
21151
- const {
21152
- tagName
21153
- } = element;
21154
- return tagName === 'INPUT' || tagName === 'BUTTON' || tagName === 'SELECT' || tagName === 'TEXTAREA';
21155
- }
21156
 
21157
- function useTabNav() {
21158
- const container = (0,external_wp_element_namespaceObject.useRef)();
21159
- const focusCaptureBeforeRef = (0,external_wp_element_namespaceObject.useRef)();
21160
- const focusCaptureAfterRef = (0,external_wp_element_namespaceObject.useRef)();
21161
- const lastFocus = (0,external_wp_element_namespaceObject.useRef)();
21162
- const {
21163
- hasMultiSelection,
21164
- getSelectedBlockClientId,
21165
- getBlockCount
21166
- } = (0,external_wp_data_namespaceObject.useSelect)(store);
21167
- const {
21168
- setNavigationMode
21169
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
21170
- const isNavigationMode = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isNavigationMode(), []); // Don't allow tabbing to this element in Navigation mode.
21171
 
21172
- const focusCaptureTabIndex = !isNavigationMode ? '0' : undefined; // Reference that holds the a flag for enabling or disabling
21173
- // capturing on the focus capture elements.
 
 
 
 
 
21174
 
21175
- const noCapture = (0,external_wp_element_namespaceObject.useRef)();
 
21176
 
21177
- function onFocusCapture(event) {
21178
- // Do not capture incoming focus if set by us in WritingFlow.
21179
- if (noCapture.current) {
21180
- noCapture.current = null;
21181
- } else if (hasMultiSelection()) {
21182
- container.current.focus();
21183
- } else if (getSelectedBlockClientId()) {
21184
- lastFocus.current.focus();
21185
- } else {
21186
- setNavigationMode(true);
21187
- const isBefore = // eslint-disable-next-line no-bitwise
21188
- event.target.compareDocumentPosition(container.current) & event.target.DOCUMENT_POSITION_FOLLOWING;
21189
- const action = isBefore ? 'findNext' : 'findPrevious';
21190
- external_wp_dom_namespaceObject.focus.tabbable[action](event.target).focus();
21191
  }
21192
- }
21193
 
21194
- const before = (0,external_wp_element_namespaceObject.createElement)("div", {
21195
- ref: focusCaptureBeforeRef,
21196
- tabIndex: focusCaptureTabIndex,
21197
- onFocus: onFocusCapture
21198
- });
21199
- const after = (0,external_wp_element_namespaceObject.createElement)("div", {
21200
- ref: focusCaptureAfterRef,
21201
- tabIndex: focusCaptureTabIndex,
21202
- onFocus: onFocusCapture
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21203
  });
21204
- const ref = (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
21205
- function onKeyDown(event) {
21206
- if (event.defaultPrevented) {
21207
- return;
21208
- }
21209
 
21210
- if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !hasMultiSelection()) {
21211
- event.preventDefault();
21212
- setNavigationMode(true);
21213
- return;
21214
- } // In Edit mode, Tab should focus the first tabbable element after
21215
- // the content, which is normally the sidebar (with block controls)
21216
- // and Shift+Tab should focus the first tabbable element before the
21217
- // content, which is normally the block toolbar.
21218
- // Arrow keys can be used, and Tab and arrow keys can be used in
21219
- // Navigation mode (press Esc), to navigate through blocks.
21220
 
21221
 
21222
- if (event.keyCode !== external_wp_keycodes_namespaceObject.TAB) {
21223
- return;
21224
- }
21225
 
21226
- const isShift = event.shiftKey;
21227
- const direction = isShift ? 'findPrevious' : 'findNext';
21228
 
21229
- if (!hasMultiSelection() && !getSelectedBlockClientId()) {
21230
- // Preserve the behaviour of entering navigation mode when
21231
- // tabbing into the content without a block selection.
21232
- // `onFocusCapture` already did this previously, but we need to
21233
- // do it again here because after clearing block selection,
21234
- // focus land on the writing flow container and pressing Tab
21235
- // will no longer send focus through the focus capture element.
21236
- if (event.target === node) setNavigationMode(true);
21237
- return;
21238
- } // Allow tabbing between form elements rendered in a block,
21239
- // such as inside a placeholder. Form elements are generally
21240
- // meant to be UI rather than part of the content. Ideally
21241
- // these are not rendered in the content and perhaps in the
21242
- // future they can be rendered in an iframe or shadow DOM.
21243
 
 
 
 
 
 
 
 
 
21244
 
21245
- if (isFormElement(event.target) && isFormElement(external_wp_dom_namespaceObject.focus.tabbable[direction](event.target))) {
21246
- return;
21247
- }
21248
 
21249
- const next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef; // Disable focus capturing on the focus capture element, so it
21250
- // doesn't refocus this block and so it allows default behaviour
21251
- // (moving focus to the next tabbable element).
21252
 
21253
- noCapture.current = true; // Focusing the focus capture element, which is located above and
21254
- // below the editor, should not scroll the page all the way up or
21255
- // down.
21256
 
21257
- next.current.focus({
21258
- preventScroll: true
21259
- });
21260
- }
21261
 
21262
- function onFocusOut(event) {
21263
- lastFocus.current = event.target;
21264
- const {
21265
- ownerDocument
21266
- } = node; // If focus disappears due to there being no blocks, move focus to
21267
- // the writing flow wrapper.
21268
 
21269
- if (!event.relatedTarget && ownerDocument.activeElement === ownerDocument.body && getBlockCount() === 0) {
21270
- node.focus();
21271
- }
21272
- } // When tabbing back to an element in block list, this event handler prevents scrolling if the
21273
- // focus capture divs (before/after) are outside of the viewport. (For example shift+tab back to a paragraph
21274
- // when focus is on a sidebar element. This prevents the scrollable writing area from jumping either to the
21275
- // top or bottom of the document.
21276
- //
21277
- // Note that it isn't possible to disable scrolling in the onFocus event. We need to intercept this
21278
- // earlier in the keypress handler, and call focus( { preventScroll: true } ) instead.
21279
- // https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus#parameters
21280
 
21281
 
21282
- function preventScrollOnTab(event) {
21283
- var _event$target;
21284
 
21285
- if (event.keyCode !== external_wp_keycodes_namespaceObject.TAB) {
21286
- return;
21287
- }
21288
 
21289
- if (((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.getAttribute('role')) === 'region') {
21290
- return;
21291
- }
21292
 
21293
- if (container.current === event.target) {
21294
- return;
21295
- }
21296
 
21297
- const isShift = event.shiftKey;
21298
- const direction = isShift ? 'findPrevious' : 'findNext';
21299
- const target = external_wp_dom_namespaceObject.focus.tabbable[direction](event.target); // only do something when the next tabbable is a focus capture div (before/after)
 
 
 
 
 
 
 
 
21300
 
21301
- if (target === focusCaptureBeforeRef.current || target === focusCaptureAfterRef.current) {
21302
- event.preventDefault();
21303
- target.focus({
21304
- preventScroll: true
21305
- });
21306
- }
21307
- }
21308
 
21309
- const {
21310
- ownerDocument
21311
- } = node;
21312
- const {
21313
- defaultView
21314
- } = ownerDocument;
21315
- defaultView.addEventListener('keydown', preventScrollOnTab);
21316
- node.addEventListener('keydown', onKeyDown);
21317
- node.addEventListener('focusout', onFocusOut);
21318
- return () => {
21319
- defaultView.removeEventListener('keydown', preventScrollOnTab);
21320
- node.removeEventListener('keydown', onKeyDown);
21321
- node.removeEventListener('focusout', onFocusOut);
21322
- };
21323
- }, []);
21324
- const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([container, ref]);
21325
- return [before, mergedRefs, after];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21326
  }
21327
- //# sourceMappingURL=use-tab-nav.js.map
21328
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/writing-flow/use-arrow-nav.js
 
 
 
 
 
 
 
 
 
 
 
 
 
21329
  /**
21330
  * External dependencies
21331
  */
@@ -21338,272 +20581,273 @@ function useTabNav() {
21338
 
21339
 
21340
 
 
21341
  /**
21342
  * Internal dependencies
21343
  */
21344
 
21345
 
21346
-
21347
  /**
21348
- * Returns true if the element should consider edge navigation upon a keyboard
21349
- * event of the given directional key code, or false otherwise.
21350
- *
21351
- * @param {Element} element HTML element to test.
21352
- * @param {number} keyCode KeyboardEvent keyCode to test.
21353
- * @param {boolean} hasModifier Whether a modifier is pressed.
21354
  *
21355
- * @return {boolean} Whether element should consider edge navigation.
 
 
 
 
 
 
 
 
21356
  */
21357
 
21358
- function isNavigationCandidate(element, keyCode, hasModifier) {
21359
- const isVertical = keyCode === external_wp_keycodes_namespaceObject.UP || keyCode === external_wp_keycodes_namespaceObject.DOWN; // Currently, all elements support unmodified vertical navigation.
21360
-
21361
- if (isVertical && !hasModifier) {
21362
- return true;
21363
- } // Native inputs should not navigate horizontally.
21364
-
21365
-
21366
- const {
21367
- tagName
21368
- } = element;
21369
- return tagName !== 'INPUT' && tagName !== 'TEXTAREA';
21370
- }
21371
  /**
21372
- * Returns the optimal tab target from the given focused element in the desired
21373
- * direction. A preference is made toward text fields, falling back to the block
21374
- * focus stop if no other candidates exist for the block.
21375
- *
21376
- * @param {Element} target Currently focused text field.
21377
- * @param {boolean} isReverse True if considering as the first field.
21378
- * @param {Element} containerElement Element containing all blocks.
21379
- * @param {boolean} onlyVertical Whether to only consider tabbable elements
21380
- * that are visually above or under the
21381
- * target.
21382
  *
21383
- * @return {?Element} Optimal tab target, if one exists.
 
21384
  */
21385
 
21386
- function getClosestTabbable(target, isReverse, containerElement, onlyVertical) {
21387
- // Since the current focus target is not guaranteed to be a text field, find
21388
- // all focusables. Tabbability is considered later.
21389
- let focusableNodes = external_wp_dom_namespaceObject.focus.focusable.find(containerElement);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21390
 
21391
- if (isReverse) {
21392
- focusableNodes = (0,external_lodash_namespaceObject.reverse)(focusableNodes);
21393
- } // Consider as candidates those focusables after the current target. It's
21394
- // assumed this can only be reached if the target is focusable (on its
21395
- // keydown event), so no need to verify it exists in the set.
21396
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21397
 
21398
- focusableNodes = focusableNodes.slice(focusableNodes.indexOf(target) + 1);
21399
- let targetRect;
 
 
 
 
 
 
 
 
 
 
 
21400
 
21401
- if (onlyVertical) {
21402
- targetRect = target.getBoundingClientRect();
21403
- }
 
 
21404
 
21405
- function isTabCandidate(node) {
21406
- // Not a candidate if the node is not tabbable.
21407
- if (!external_wp_dom_namespaceObject.focus.tabbable.isTabbableIndex(node)) {
21408
- return false;
21409
- } // Skip focusable elements such as links within content editable nodes.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21410
 
 
21411
 
21412
- if (node.isContentEditable && node.contentEditable !== 'true') {
21413
- return false;
21414
- }
21415
 
21416
- if (onlyVertical) {
21417
- const nodeRect = node.getBoundingClientRect();
21418
 
21419
- if (nodeRect.left >= targetRect.right || nodeRect.right <= targetRect.left) {
21420
- return false;
21421
- }
21422
- }
21423
 
21424
- return true;
21425
- }
21426
 
21427
- return (0,external_lodash_namespaceObject.find)(focusableNodes, isTabCandidate);
21428
- }
21429
- function useArrowNav() {
21430
- const {
21431
- getSelectedBlockClientId,
21432
- getMultiSelectedBlocksStartClientId,
21433
- getMultiSelectedBlocksEndClientId,
21434
- getPreviousBlockClientId,
21435
- getNextBlockClientId,
21436
- getFirstMultiSelectedBlockClientId,
21437
- getLastMultiSelectedBlockClientId,
21438
- getSettings,
21439
- hasMultiSelection
21440
- } = (0,external_wp_data_namespaceObject.useSelect)(store);
21441
- const {
21442
- multiSelect,
21443
- selectBlock
21444
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
21445
- return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
21446
- // Here a DOMRect is stored while moving the caret vertically so
21447
- // vertical position of the start position can be restored. This is to
21448
- // recreate browser behaviour across blocks.
21449
- let verticalRect;
21450
 
21451
- function onMouseDown() {
21452
- verticalRect = null;
21453
- }
21454
 
21455
- function expandSelection(isReverse) {
21456
- const selectedBlockClientId = getSelectedBlockClientId();
21457
- const selectionStartClientId = getMultiSelectedBlocksStartClientId();
21458
- const selectionEndClientId = getMultiSelectedBlocksEndClientId();
21459
- const selectionBeforeEndClientId = getPreviousBlockClientId(selectionEndClientId || selectedBlockClientId);
21460
- const selectionAfterEndClientId = getNextBlockClientId(selectionEndClientId || selectedBlockClientId);
21461
- const nextSelectionEndClientId = isReverse ? selectionBeforeEndClientId : selectionAfterEndClientId;
21462
 
21463
- if (nextSelectionEndClientId) {
21464
- if (selectionStartClientId === nextSelectionEndClientId) {
21465
- selectBlock(nextSelectionEndClientId);
21466
- } else {
21467
- multiSelect(selectionStartClientId || selectedBlockClientId, nextSelectionEndClientId);
21468
- }
21469
- }
21470
- }
21471
 
21472
- function moveSelection(isReverse) {
21473
- const selectedFirstClientId = getFirstMultiSelectedBlockClientId();
21474
- const selectedLastClientId = getLastMultiSelectedBlockClientId();
21475
- const focusedBlockClientId = isReverse ? selectedFirstClientId : selectedLastClientId;
 
 
 
 
 
 
21476
 
21477
- if (focusedBlockClientId) {
21478
- selectBlock(focusedBlockClientId);
21479
- }
21480
- }
21481
- /**
21482
- * Returns true if the given target field is the last in its block which
21483
- * can be considered for tab transition. For example, in a block with
21484
- * two text fields, this would return true when reversing from the first
21485
- * of the two fields, but false when reversing from the second.
21486
- *
21487
- * @param {Element} target Currently focused text field.
21488
- * @param {boolean} isReverse True if considering as the first field.
21489
- *
21490
- * @return {boolean} Whether field is at edge for tab transition.
21491
- */
21492
 
 
 
 
 
21493
 
21494
- function isTabbableEdge(target, isReverse) {
21495
- const closestTabbable = getClosestTabbable(target, isReverse, node);
21496
- return !closestTabbable || !isInSameBlock(target, closestTabbable);
21497
- }
21498
 
21499
- function onKeyDown(event) {
21500
- const {
21501
- keyCode,
21502
- target
21503
- } = event;
21504
- const isUp = keyCode === external_wp_keycodes_namespaceObject.UP;
21505
- const isDown = keyCode === external_wp_keycodes_namespaceObject.DOWN;
21506
- const isLeft = keyCode === external_wp_keycodes_namespaceObject.LEFT;
21507
- const isRight = keyCode === external_wp_keycodes_namespaceObject.RIGHT;
21508
- const isReverse = isUp || isLeft;
21509
- const isHorizontal = isLeft || isRight;
21510
- const isVertical = isUp || isDown;
21511
- const isNav = isHorizontal || isVertical;
21512
- const isShift = event.shiftKey;
21513
- const hasModifier = isShift || event.ctrlKey || event.altKey || event.metaKey;
21514
- const isNavEdge = isVertical ? external_wp_dom_namespaceObject.isVerticalEdge : external_wp_dom_namespaceObject.isHorizontalEdge;
21515
- const {
21516
- ownerDocument
21517
- } = node;
21518
- const {
21519
- defaultView
21520
- } = ownerDocument;
21521
 
21522
- if (hasMultiSelection()) {
21523
- if (isNav) {
21524
- const action = isShift ? expandSelection : moveSelection;
21525
- action(isReverse);
21526
- event.preventDefault();
21527
- }
21528
 
21529
- return;
21530
- } // When presing any key other than up or down, the initial vertical
21531
- // position must ALWAYS be reset. The vertical position is saved so
21532
- // it can be restored as well as possible on sebsequent vertical
21533
- // arrow key presses. It may not always be possible to restore the
21534
- // exact same position (such as at an empty line), so it wouldn't be
21535
- // good to compute the position right before any vertical arrow key
21536
- // press.
21537
 
 
 
 
 
 
 
21538
 
21539
- if (!isVertical) {
21540
- verticalRect = null;
21541
- } else if (!verticalRect) {
21542
- verticalRect = (0,external_wp_dom_namespaceObject.computeCaretRect)(defaultView);
21543
- } // Abort if navigation has already been handled (e.g. RichText
21544
- // inline boundaries).
 
 
 
 
 
 
 
 
21545
 
 
 
21546
 
21547
- if (event.defaultPrevented) {
21548
- return;
21549
- }
21550
 
21551
- if (!isNav) {
21552
- return;
21553
- } // Abort if our current target is not a candidate for navigation
21554
- // (e.g. preserve native input behaviors).
 
 
 
 
 
 
 
 
 
 
 
 
 
21555
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21556
 
21557
- if (!isNavigationCandidate(target, keyCode, hasModifier)) {
21558
- return;
21559
- } // In the case of RTL scripts, right means previous and left means
21560
- // next, which is the exact reverse of LTR.
 
 
 
 
21561
 
 
 
 
 
21562
 
21563
- const isReverseDir = (0,external_wp_dom_namespaceObject.isRTL)(target) ? !isReverse : isReverse;
21564
- const {
21565
- keepCaretInsideBlock
21566
- } = getSettings();
21567
- const selectedBlockClientId = getSelectedBlockClientId();
21568
 
21569
- if (isShift) {
21570
- const selectionEndClientId = getMultiSelectedBlocksEndClientId();
21571
- const selectionBeforeEndClientId = getPreviousBlockClientId(selectionEndClientId || selectedBlockClientId);
21572
- const selectionAfterEndClientId = getNextBlockClientId(selectionEndClientId || selectedBlockClientId);
21573
 
21574
- if ( // Ensure that there is a target block.
21575
- (isReverse && selectionBeforeEndClientId || !isReverse && selectionAfterEndClientId) && isTabbableEdge(target, isReverse) && isNavEdge(target, isReverse)) {
21576
- // Shift key is down, and there is multi selection or we're
21577
- // at the end of the current block.
21578
- expandSelection(isReverse);
21579
- event.preventDefault();
21580
- }
21581
- } else if (isVertical && (0,external_wp_dom_namespaceObject.isVerticalEdge)(target, isReverse) && !keepCaretInsideBlock) {
21582
- const closestTabbable = getClosestTabbable(target, isReverse, node, true);
21583
 
21584
- if (closestTabbable) {
21585
- (0,external_wp_dom_namespaceObject.placeCaretAtVerticalEdge)(closestTabbable, isReverse, verticalRect);
21586
- event.preventDefault();
21587
- }
21588
- } else if (isHorizontal && defaultView.getSelection().isCollapsed && (0,external_wp_dom_namespaceObject.isHorizontalEdge)(target, isReverseDir) && !keepCaretInsideBlock) {
21589
- const closestTabbable = getClosestTabbable(target, isReverseDir, node);
21590
- (0,external_wp_dom_namespaceObject.placeCaretAtHorizontalEdge)(closestTabbable, isReverse);
21591
- event.preventDefault();
21592
- }
21593
- }
21594
 
21595
- node.addEventListener('mousedown', onMouseDown);
21596
- node.addEventListener('keydown', onKeyDown);
21597
- return () => {
21598
- node.removeEventListener('mousedown', onMouseDown);
21599
- node.removeEventListener('keydown', onKeyDown);
21600
- };
21601
- }, []);
21602
- }
21603
- //# sourceMappingURL=use-arrow-nav.js.map
21604
- ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
21605
- var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
21606
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/writing-flow/use-select-all.js
21607
  /**
21608
  * External dependencies
21609
  */
@@ -21616,129 +20860,181 @@ var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortc
21616
 
21617
 
21618
 
 
21619
  /**
21620
  * Internal dependencies
21621
  */
21622
 
21623
 
21624
- function useSelectAll() {
21625
- const {
21626
- getBlockOrder,
21627
- getSelectedBlockClientIds,
21628
- getBlockRootClientId
21629
- } = (0,external_wp_data_namespaceObject.useSelect)(store);
21630
- const {
21631
- multiSelect
21632
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
21633
- const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)();
21634
- return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
21635
- function onKeyDown(event) {
21636
- if (!isMatch('core/block-editor/select-all', event)) {
21637
- return;
21638
- }
21639
-
21640
- if (!(0,external_wp_dom_namespaceObject.isEntirelySelected)(event.target)) {
21641
- return;
21642
- }
21643
 
21644
- const selectedClientIds = getSelectedBlockClientIds();
21645
- const [firstSelectedClientId] = selectedClientIds;
21646
- const rootClientId = getBlockRootClientId(firstSelectedClientId);
21647
- let blockClientIds = getBlockOrder(rootClientId); // If we have selected all sibling nested blocks, try selecting up a
21648
- // level. See: https://github.com/WordPress/gutenberg/pull/31859/
21649
 
21650
- if (selectedClientIds.length === blockClientIds.length) {
21651
- blockClientIds = getBlockOrder(getBlockRootClientId(rootClientId));
21652
- }
21653
 
21654
- const firstClientId = (0,external_lodash_namespaceObject.first)(blockClientIds);
21655
- const lastClientId = (0,external_lodash_namespaceObject.last)(blockClientIds);
21656
 
21657
- if (firstClientId === lastClientId) {
21658
- return;
21659
- }
21660
 
21661
- multiSelect(firstClientId, lastClientId);
21662
- event.preventDefault();
21663
- }
21664
 
21665
- node.addEventListener('keydown', onKeyDown);
21666
- return () => {
21667
- node.removeEventListener('keydown', onKeyDown);
21668
- };
21669
- }, []);
21670
- }
21671
- //# sourceMappingURL=use-select-all.js.map
21672
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/writing-flow/index.js
21673
 
21674
 
21675
 
 
21676
  /**
21677
- * External dependencies
 
 
 
21678
  */
21679
 
21680
- /**
21681
- * WordPress dependencies
21682
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21683
 
 
 
 
21684
 
 
 
 
21685
 
 
 
 
21686
 
21687
 
21688
  /**
21689
- * Internal dependencies
21690
  */
21691
 
21692
 
21693
 
 
 
21694
 
 
 
 
 
 
21695
 
 
 
 
 
 
21696
 
21697
- function useWritingFlow() {
21698
- const [before, ref, after] = useTabNav();
21699
- const hasMultiSelection = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).hasMultiSelection(), []);
21700
- return [before, (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, use_multi_selection_useMultiSelection(), useSelectAll(), useArrowNav(), (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
21701
- node.tabIndex = -1;
21702
-
21703
- if (!hasMultiSelection) {
21704
- return;
21705
- }
21706
-
21707
- node.setAttribute('aria-label', (0,external_wp_i18n_namespaceObject.__)('Multiple selected blocks'));
21708
- return () => {
21709
- node.removeAttribute('aria-label');
21710
- };
21711
- }, [hasMultiSelection])]), after];
21712
- }
21713
 
21714
- function WritingFlow({
21715
  children,
21716
- ...props
21717
- }, forwardedRef) {
21718
- const [before, ref, after] = useWritingFlow();
21719
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, before, (0,external_wp_element_namespaceObject.createElement)("div", _extends({}, props, {
21720
- ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, forwardedRef]),
21721
- className: classnames_default()(props.className, 'block-editor-writing-flow')
21722
- }), children), after);
21723
- }
21724
- /**
21725
- * Handles selection and navigation across blocks. This component should be
21726
- * wrapped around BlockList.
21727
- *
21728
- * @param {Object} props Component properties.
21729
- * @param {WPElement} props.children Children to be rendered.
21730
- */
21731
 
 
 
 
21732
 
21733
- /* harmony default export */ var writing_flow = ((0,external_wp_element_namespaceObject.forwardRef)(WritingFlow));
21734
- //# sourceMappingURL=index.js.map
21735
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/iframe/index.js
21736
 
 
 
 
 
 
 
 
 
21737
 
 
 
 
21738
 
21739
- /**
21740
- * External dependencies
21741
- */
21742
 
21743
  /**
21744
  * WordPress dependencies
@@ -21747,1417 +21043,1786 @@ function WritingFlow({
21747
 
21748
 
21749
 
21750
-
21751
  /**
21752
  * Internal dependencies
21753
  */
21754
 
21755
 
21756
 
21757
- const BODY_CLASS_NAME = 'editor-styles-wrapper';
21758
- const BLOCK_PREFIX = 'wp-block';
21759
- /**
21760
- * Clones stylesheets targetting the editor canvas to the given document. A
21761
- * stylesheet is considered targetting the editor a canvas if it contains the
21762
- * `editor-styles-wrapper`, `wp-block`, or `wp-block-*` class selectors.
21763
- *
21764
- * Ideally, this hook should be removed in the future and styles should be added
21765
- * explicitly as editor styles.
21766
- *
21767
- * @param {Document} doc The document to append cloned stylesheets to.
21768
- */
21769
-
21770
- function styleSheetsCompat(doc) {
21771
- // Search the document for stylesheets targetting the editor canvas.
21772
- Array.from(document.styleSheets).forEach(styleSheet => {
21773
- try {
21774
- // May fail for external styles.
21775
- // eslint-disable-next-line no-unused-expressions
21776
- styleSheet.cssRules;
21777
- } catch (e) {
21778
- return;
21779
- }
21780
-
21781
- const {
21782
- ownerNode,
21783
- cssRules
21784
- } = styleSheet;
21785
-
21786
- if (!cssRules) {
21787
- return;
21788
- } // Generally, ignore inline styles. We add inline styles belonging to a
21789
- // stylesheet later, which may or may not match the selectors.
21790
 
21791
 
21792
- if (ownerNode.tagName !== 'LINK') {
21793
- return;
21794
- } // Don't try to add the reset styles, which were removed as a dependency
21795
- // from `edit-blocks` for the iframe since we don't need to reset admin
21796
- // styles.
21797
 
21798
 
21799
- if (ownerNode.id === 'wp-reset-editor-styles-css') {
21800
- return;
21801
- }
21802
 
21803
- const isMatch = Array.from(cssRules).find(({
21804
- selectorText
21805
- }) => selectorText && (selectorText.includes(`.${BODY_CLASS_NAME}`) || selectorText.includes(`.${BLOCK_PREFIX}`)));
21806
 
21807
- if (isMatch && !doc.getElementById(ownerNode.id)) {
21808
- // eslint-disable-next-line no-console
21809
- console.error(`Stylesheet ${ownerNode.id} was not properly added.
21810
- For blocks, use the block API's style (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#style) or editorStyle (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#editor-style).
21811
- For themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles).`, ownerNode.outerHTML);
21812
- doc.head.appendChild(ownerNode.cloneNode(true)); // Add inline styles belonging to the stylesheet.
21813
 
21814
- const inlineCssId = ownerNode.id.replace('-css', '-inline-css');
21815
- const inlineCssElement = document.getElementById(inlineCssId);
21816
 
21817
- if (inlineCssElement) {
21818
- doc.head.appendChild(inlineCssElement.cloneNode(true));
21819
- }
21820
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21821
  });
21822
- }
21823
- /**
21824
- * Bubbles some event types (keydown, keypress, and dragover) to parent document
21825
- * document to ensure that the keyboard shortcuts and drag and drop work.
21826
- *
21827
- * Ideally, we should remove event bubbling in the future. Keyboard shortcuts
21828
- * should be context dependent, e.g. actions on blocks like Cmd+A should not
21829
- * work globally outside the block editor.
21830
- *
21831
- * @param {Document} doc Document to attach listeners to.
21832
- */
21833
-
21834
-
21835
- function bubbleEvents(doc) {
21836
- const {
21837
- defaultView
21838
- } = doc;
21839
  const {
21840
- frameElement
21841
- } = defaultView;
21842
-
21843
- function bubbleEvent(event) {
21844
- const prototype = Object.getPrototypeOf(event);
21845
- const constructorName = prototype.constructor.name;
21846
- const Constructor = window[constructorName];
21847
- const init = {};
21848
-
21849
- for (const key in event) {
21850
- init[key] = event[key];
21851
- }
21852
-
21853
- if (event instanceof defaultView.MouseEvent) {
21854
- const rect = frameElement.getBoundingClientRect();
21855
- init.clientX += rect.left;
21856
- init.clientY += rect.top;
21857
- }
21858
-
21859
- const newEvent = new Constructor(event.type, init);
21860
- const cancelled = !frameElement.dispatchEvent(newEvent);
21861
 
21862
- if (cancelled) {
21863
- event.preventDefault();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21864
  }
21865
- }
21866
-
21867
- const eventTypes = ['dragover'];
21868
 
21869
- for (const name of eventTypes) {
21870
- doc.addEventListener(name, bubbleEvent);
21871
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21872
  }
21873
 
21874
- function useParsedAssets(html) {
21875
- return (0,external_wp_element_namespaceObject.useMemo)(() => {
21876
- const doc = document.implementation.createHTMLDocument('');
21877
- doc.body.innerHTML = html;
21878
- return Array.from(doc.body.children);
21879
- }, [html]);
21880
- }
21881
 
21882
- async function loadScript(head, {
21883
- id,
21884
- src
21885
- }) {
21886
- return new Promise((resolve, reject) => {
21887
- const script = head.ownerDocument.createElement('script');
21888
- script.id = id;
21889
 
21890
- if (src) {
21891
- script.src = src;
 
21892
 
21893
- script.onload = () => resolve();
 
 
21894
 
21895
- script.onerror = () => reject();
21896
- } else {
21897
- resolve();
21898
- }
21899
 
21900
- head.appendChild(script);
21901
- });
21902
- }
21903
 
21904
- function Iframe({
21905
- contentRef,
21906
- children,
21907
- head,
21908
- tabIndex = 0,
21909
- ...props
21910
- }, ref) {
21911
- var _window$__editorAsset, _window$__editorAsset2;
21912
 
21913
- const [, forceRender] = (0,external_wp_element_namespaceObject.useReducer)(() => ({}));
21914
- const [iframeDocument, setIframeDocument] = (0,external_wp_element_namespaceObject.useState)();
21915
- const [bodyClasses, setBodyClasses] = (0,external_wp_element_namespaceObject.useState)([]);
21916
- const styles = useParsedAssets((_window$__editorAsset = window.__editorAssets) === null || _window$__editorAsset === void 0 ? void 0 : _window$__editorAsset.styles);
21917
- const scripts = useParsedAssets((_window$__editorAsset2 = window.__editorAssets) === null || _window$__editorAsset2 === void 0 ? void 0 : _window$__editorAsset2.scripts);
21918
- const clearerRef = useBlockSelectionClearer();
21919
- const [before, writingFlowRef, after] = useWritingFlow();
21920
- const setRef = (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
21921
- function setDocumentIfReady() {
21922
- const {
21923
- contentDocument,
21924
- ownerDocument
21925
- } = node;
21926
- const {
21927
- readyState,
21928
- documentElement
21929
- } = contentDocument;
21930
 
21931
- if (readyState !== 'interactive' && readyState !== 'complete') {
21932
- return false;
21933
- }
21934
 
21935
- bubbleEvents(contentDocument);
21936
- setIframeDocument(contentDocument);
21937
- clearerRef(documentElement); // Ideally ALL classes that are added through get_body_class should
21938
- // be added in the editor too, which we'll somehow have to get from
21939
- // the server in the future (which will run the PHP filters).
21940
 
21941
- setBodyClasses(Array.from(ownerDocument.body.classList).filter(name => name.startsWith('admin-color-') || name === 'wp-embed-responsive'));
21942
- contentDocument.dir = ownerDocument.dir;
21943
- documentElement.removeChild(contentDocument.head);
21944
- documentElement.removeChild(contentDocument.body);
21945
- return true;
21946
- }
21947
 
21948
- if (setDocumentIfReady()) {
21949
- return;
21950
- } // Document is not immediately loaded in Firefox.
21951
 
21952
 
21953
- node.addEventListener('load', () => {
21954
- setDocumentIfReady();
21955
- });
21956
- }, []);
21957
- const headRef = (0,external_wp_compose_namespaceObject.useRefEffect)(element => {
21958
- scripts.reduce((promise, script) => promise.then(() => loadScript(element, script)), Promise.resolve()).finally(() => {
21959
- // When script are loaded, re-render blocks to allow them
21960
- // to initialise.
21961
- forceRender();
21962
- });
21963
- }, []);
21964
- const bodyRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([contentRef, clearerRef, writingFlowRef]);
21965
- (0,external_wp_element_namespaceObject.useEffect)(() => {
21966
- if (iframeDocument) {
21967
- styleSheetsCompat(iframeDocument);
21968
- }
21969
- }, [iframeDocument]);
21970
- head = (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("style", null, 'body{margin:0}'), styles.map(({
21971
- tagName,
21972
- href,
21973
- id,
21974
- rel,
21975
- media,
21976
- textContent
21977
- }) => {
21978
- const TagName = tagName.toLowerCase();
21979
 
21980
- if (TagName === 'style') {
21981
- return (0,external_wp_element_namespaceObject.createElement)(TagName, {
21982
- id,
21983
- key: id
21984
- }, textContent);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21985
  }
 
 
21986
 
21987
- return (0,external_wp_element_namespaceObject.createElement)(TagName, {
21988
- href,
21989
- id,
21990
- rel,
21991
- media,
21992
- key: id
21993
  });
21994
- }), head);
21995
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, tabIndex >= 0 && before, (0,external_wp_element_namespaceObject.createElement)("iframe", _extends({}, props, {
21996
- ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, setRef]),
21997
- tabIndex: tabIndex,
21998
- title: (0,external_wp_i18n_namespaceObject.__)('Editor canvas')
21999
- }), iframeDocument && (0,external_wp_element_namespaceObject.createPortal)((0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("head", {
22000
- ref: headRef
22001
- }, head), (0,external_wp_element_namespaceObject.createElement)("body", {
22002
- ref: bodyRef,
22003
- className: classnames_default()(BODY_CLASS_NAME, ...bodyClasses)
22004
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalStyleProvider, {
22005
- document: iframeDocument
22006
- }, children))), iframeDocument.documentElement)), tabIndex >= 0 && after);
22007
- }
22008
-
22009
- /* harmony default export */ var iframe = ((0,external_wp_element_namespaceObject.forwardRef)(Iframe));
22010
- //# sourceMappingURL=index.js.map
22011
- // EXTERNAL MODULE: ./node_modules/traverse/index.js
22012
- var traverse = __webpack_require__(3692);
22013
- var traverse_default = /*#__PURE__*/__webpack_require__.n(traverse);
22014
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/transform-styles/ast/parse.js
22015
- /* eslint-disable @wordpress/no-unused-vars-before-return */
22016
- // Adapted from https://github.com/reworkcss/css
22017
- // because we needed to remove source map support.
22018
- // http://www.w3.org/TR/CSS21/grammar.htm
22019
- // https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
22020
- const commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
22021
- /* harmony default export */ function parse(css, options) {
22022
- options = options || {};
22023
- /**
22024
- * Positional.
22025
- */
22026
-
22027
- let lineno = 1;
22028
- let column = 1;
22029
- /**
22030
- * Update lineno and column based on `str`.
22031
- */
22032
-
22033
- function updatePosition(str) {
22034
- const lines = str.match(/\n/g);
22035
-
22036
- if (lines) {
22037
- lineno += lines.length;
22038
- }
22039
-
22040
- const i = str.lastIndexOf('\n'); // eslint-disable-next-line no-bitwise
22041
 
22042
- column = ~i ? str.length - i : column + str.length;
22043
- }
22044
- /**
22045
- * Mark position and patch `node.position`.
22046
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22047
 
22048
 
22049
- function position() {
22050
- const start = {
22051
- line: lineno,
22052
- column
22053
- };
22054
- return function (node) {
22055
- node.position = new Position(start);
22056
- whitespace();
22057
- return node;
22058
- };
22059
- }
22060
- /**
22061
- * Store position information for a node
22062
- */
22063
 
 
 
 
22064
 
22065
- function Position(start) {
22066
- this.start = start;
22067
- this.end = {
22068
- line: lineno,
22069
- column
22070
- };
22071
- this.source = options.source;
22072
- }
22073
- /**
22074
- * Non-enumerable source string
22075
- */
22076
 
 
 
 
22077
 
22078
- Position.prototype.content = css;
22079
- /**
22080
- * Error `msg`.
22081
- */
22082
 
22083
- const errorsList = [];
22084
 
22085
- function error(msg) {
22086
- const err = new Error(options.source + ':' + lineno + ':' + column + ': ' + msg);
22087
- err.reason = msg;
22088
- err.filename = options.source;
22089
- err.line = lineno;
22090
- err.column = column;
22091
- err.source = css;
22092
 
22093
- if (options.silent) {
22094
- errorsList.push(err);
22095
- } else {
22096
- throw err;
22097
- }
22098
- }
22099
- /**
22100
- * Parse stylesheet.
22101
- */
22102
 
22103
 
22104
- function stylesheet() {
22105
- const rulesList = rules();
22106
- return {
22107
- type: 'stylesheet',
22108
- stylesheet: {
22109
- source: options.source,
22110
- rules: rulesList,
22111
- parsingErrors: errorsList
22112
- }
22113
- };
22114
- }
22115
- /**
22116
- * Opening brace.
22117
- */
22118
 
22119
 
22120
- function open() {
22121
- return match(/^{\s*/);
22122
- }
22123
- /**
22124
- * Closing brace.
22125
- */
22126
 
22127
 
22128
- function close() {
22129
- return match(/^}/);
22130
- }
22131
- /**
22132
- * Parse ruleset.
22133
- */
22134
 
22135
 
22136
- function rules() {
22137
- let node;
22138
- const accumulator = [];
22139
- whitespace();
22140
- comments(accumulator);
22141
 
22142
- while (css.length && css.charAt(0) !== '}' && (node = atrule() || rule())) {
22143
- if (node !== false) {
22144
- accumulator.push(node);
22145
- comments(accumulator);
22146
- }
22147
- }
 
 
 
22148
 
22149
- return accumulator;
 
 
 
 
22150
  }
22151
- /**
22152
- * Match `re` and return captures.
22153
- */
22154
 
 
 
 
 
22155
 
22156
- function match(re) {
22157
- const m = re.exec(css);
 
 
22158
 
22159
- if (!m) {
22160
- return;
22161
  }
 
22162
 
22163
- const str = m[0];
22164
- updatePosition(str);
22165
- css = css.slice(str.length);
22166
- return m;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22167
  }
22168
- /**
22169
- * Parse whitespace.
22170
- */
22171
 
 
 
 
 
22172
 
22173
- function whitespace() {
22174
- match(/^\s*/);
 
22175
  }
22176
  /**
22177
- * Parse comments;
 
 
 
 
 
 
 
22178
  */
22179
 
22180
 
22181
- function comments(accumulator) {
22182
- let c;
22183
- accumulator = accumulator || []; // eslint-disable-next-line no-cond-assign
22184
-
22185
- while (c = comment()) {
22186
- if (c !== false) {
22187
- accumulator.push(c);
22188
- }
22189
- }
22190
-
22191
- return accumulator;
 
 
 
 
 
 
 
 
 
 
 
22192
  }
22193
  /**
22194
- * Parse comment.
 
 
 
 
 
 
22195
  */
22196
 
22197
 
22198
- function comment() {
22199
- const pos = position();
 
 
 
 
 
 
 
 
 
 
22200
 
22201
- if ('/' !== css.charAt(0) || '*' !== css.charAt(1)) {
22202
- return;
 
 
 
 
 
 
 
22203
  }
22204
 
22205
- let i = 2;
22206
-
22207
- while ('' !== css.charAt(i) && ('*' !== css.charAt(i) || '/' !== css.charAt(i + 1))) {
22208
- ++i;
22209
- }
 
 
 
 
 
22210
 
22211
- i += 2;
 
 
 
 
 
 
 
 
22212
 
22213
- if ('' === css.charAt(i - 1)) {
22214
- return error('End of comment missing');
 
 
22215
  }
22216
 
22217
- const str = css.slice(2, i - 2);
22218
- column += 2;
22219
- updatePosition(str);
22220
- css = css.slice(i);
22221
- column += 2;
22222
- return pos({
22223
- type: 'comment',
22224
- comment: str
 
 
 
 
22225
  });
22226
  }
22227
- /**
22228
- * Parse selector.
22229
- */
22230
 
 
22231
 
22232
- function selector() {
22233
- const m = match(/^([^{]+)/);
 
 
 
 
 
 
 
 
 
 
 
 
22234
 
22235
- if (!m) {
22236
- return;
22237
- } // FIXME: Remove all comments from selectors http://ostermiller.org/findcomment.html
22238
 
 
22239
 
22240
- return trim(m[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, '').replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, function (matched) {
22241
- return matched.replace(/,/g, '\u200C');
22242
- }).split(/\s*(?![^(]*\)),\s*/).map(function (s) {
22243
- return s.replace(/\u200C/g, ',');
22244
- });
22245
  }
22246
- /**
22247
- * Parse declaration.
22248
- */
22249
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22250
 
22251
- function declaration() {
22252
- const pos = position(); // prop
 
22253
 
22254
- let prop = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);
 
 
 
 
 
 
22255
 
22256
- if (!prop) {
22257
- return;
22258
- }
22259
 
22260
- prop = trim(prop[0]); // :
22261
 
22262
- if (!match(/^:\s*/)) {
22263
- return error("property missing ':'");
22264
- } // val
22265
 
 
 
 
22266
 
22267
- const val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/);
22268
- const ret = pos({
22269
- type: 'declaration',
22270
- property: prop.replace(commentre, ''),
22271
- value: val ? trim(val[0]).replace(commentre, '') : ''
22272
- }); // ;
22273
 
22274
- match(/^[;\s]*/);
22275
- return ret;
22276
- }
22277
- /**
22278
- * Parse declarations.
22279
- */
22280
 
 
 
 
 
 
22281
 
22282
- function declarations() {
22283
- const decls = [];
 
22284
 
22285
- if (!open()) {
22286
- return error("missing '{'");
 
22287
  }
22288
 
22289
- comments(decls); // declarations
 
 
 
 
 
 
 
 
 
 
22290
 
22291
- let decl; // eslint-disable-next-line no-cond-assign
22292
 
22293
- while (decl = declaration()) {
22294
- if (decl !== false) {
22295
- decls.push(decl);
22296
- comments(decls);
22297
- }
22298
- }
22299
 
22300
- if (!close()) {
22301
- return error("missing '}'");
22302
- }
22303
 
22304
- return decls;
22305
- }
22306
- /**
22307
- * Parse keyframe.
22308
- */
22309
 
22310
 
22311
- function keyframe() {
22312
- let m;
22313
- const vals = [];
22314
- const pos = position(); // eslint-disable-next-line no-cond-assign
22315
 
22316
- while (m = match(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/)) {
22317
- vals.push(m[1]);
22318
- match(/^,\s*/);
22319
- }
22320
 
22321
- if (!vals.length) {
22322
- return;
22323
- }
22324
 
22325
- return pos({
22326
- type: 'keyframe',
22327
- values: vals,
22328
- declarations: declarations()
22329
- });
22330
- }
22331
- /**
22332
- * Parse keyframes.
22333
- */
22334
 
22335
 
22336
- function atkeyframes() {
22337
- const pos = position();
22338
- let m = match(/^@([-\w]+)?keyframes\s*/);
22339
 
22340
- if (!m) {
22341
- return;
22342
- }
 
22343
 
22344
- const vendor = m[1]; // identifier
 
 
 
 
 
 
 
 
 
 
 
22345
 
22346
- m = match(/^([-\w]+)\s*/);
22347
 
22348
- if (!m) {
22349
- return error('@keyframes missing name');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22350
  }
22351
 
22352
- const name = m[1];
 
 
 
 
 
 
 
 
 
 
 
 
22353
 
22354
- if (!open()) {
22355
- return error("@keyframes missing '{'");
22356
- }
22357
 
22358
- let frame;
22359
- let frames = comments(); // eslint-disable-next-line no-cond-assign
22360
 
22361
- while (frame = keyframe()) {
22362
- frames.push(frame);
22363
- frames = frames.concat(comments());
22364
- }
22365
 
22366
- if (!close()) {
22367
- return error("@keyframes missing '}'");
22368
- }
22369
 
22370
- return pos({
22371
- type: 'keyframes',
22372
- name,
22373
- vendor,
22374
- keyframes: frames
22375
- });
22376
- }
22377
- /**
22378
- * Parse supports.
22379
- */
22380
 
 
 
 
22381
 
22382
- function atsupports() {
22383
- const pos = position();
22384
- const m = match(/^@supports *([^{]+)/);
22385
 
22386
- if (!m) {
22387
- return;
22388
- }
22389
 
22390
- const supports = trim(m[1]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22391
 
22392
- if (!open()) {
22393
- return error("@supports missing '{'");
22394
- }
 
 
 
22395
 
22396
- const style = comments().concat(rules());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22397
 
22398
- if (!close()) {
22399
- return error("@supports missing '}'");
22400
- }
 
 
22401
 
22402
- return pos({
22403
- type: 'supports',
22404
- supports,
22405
- rules: style
22406
- });
22407
- }
22408
- /**
22409
- * Parse host.
22410
- */
 
22411
 
22412
 
22413
- function athost() {
22414
- const pos = position();
22415
- const m = match(/^@host\s*/);
 
 
 
 
 
 
22416
 
22417
- if (!m) {
22418
- return;
22419
- }
22420
 
22421
- if (!open()) {
22422
- return error("@host missing '{'");
22423
- }
22424
 
22425
- const style = comments().concat(rules());
 
 
22426
 
22427
- if (!close()) {
22428
- return error("@host missing '}'");
22429
- }
22430
 
22431
- return pos({
22432
- type: 'host',
22433
- rules: style
22434
- });
22435
- }
22436
- /**
22437
- * Parse media.
22438
- */
22439
 
22440
 
22441
- function atmedia() {
22442
- const pos = position();
22443
- const m = match(/^@media *([^{]+)/);
22444
 
22445
- if (!m) {
22446
- return;
22447
- }
22448
 
22449
- const media = trim(m[1]);
22450
 
22451
- if (!open()) {
22452
- return error("@media missing '{'");
22453
- }
22454
 
22455
- const style = comments().concat(rules());
22456
 
22457
- if (!close()) {
22458
- return error("@media missing '}'");
22459
- }
22460
 
22461
- return pos({
22462
- type: 'media',
22463
- media,
22464
- rules: style
22465
- });
 
 
 
 
 
 
 
22466
  }
22467
- /**
22468
- * Parse custom-media.
22469
- */
22470
 
 
22471
 
22472
- function atcustommedia() {
22473
- const pos = position();
22474
- const m = match(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);
 
 
 
 
22475
 
22476
- if (!m) {
22477
- return;
22478
  }
22479
 
22480
- return pos({
22481
- type: 'custom-media',
22482
- name: trim(m[1]),
22483
- media: trim(m[2])
22484
- });
 
 
 
 
 
 
 
 
 
 
22485
  }
22486
- /**
22487
- * Parse paged media.
22488
- */
22489
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22490
 
22491
- function atpage() {
22492
- const pos = position();
22493
- const m = match(/^@page */);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22494
 
22495
- if (!m) {
 
 
 
 
 
 
 
 
 
 
22496
  return;
22497
  }
22498
 
22499
- const sel = selector() || [];
 
 
 
 
 
 
 
22500
 
22501
- if (!open()) {
22502
- return error("@page missing '{'");
22503
- }
22504
 
22505
- let decls = comments(); // declarations
 
 
 
 
 
 
 
 
 
 
22506
 
22507
- let decl; // eslint-disable-next-line no-cond-assign
22508
 
22509
- while (decl = declaration()) {
22510
- decls.push(decl);
22511
- decls = decls.concat(comments());
22512
- }
22513
 
22514
- if (!close()) {
22515
- return error("@page missing '}'");
22516
- }
22517
 
22518
- return pos({
22519
- type: 'page',
22520
- selectors: sel,
22521
- declarations: decls
22522
- });
22523
- }
22524
- /**
22525
- * Parse document.
22526
- */
22527
 
22528
 
22529
- function atdocument() {
22530
- const pos = position();
22531
- const m = match(/^@([-\w]+)?document *([^{]+)/);
22532
 
22533
- if (!m) {
22534
- return;
22535
- }
22536
 
22537
- const vendor = trim(m[1]);
22538
- const doc = trim(m[2]);
22539
 
22540
- if (!open()) {
22541
- return error("@document missing '{'");
22542
- }
22543
 
22544
- const style = comments().concat(rules());
22545
 
22546
- if (!close()) {
22547
- return error("@document missing '}'");
22548
- }
22549
 
22550
- return pos({
22551
- type: 'document',
22552
- document: doc,
22553
- vendor,
22554
- rules: style
22555
- });
22556
- }
22557
- /**
22558
- * Parse font-face.
22559
- */
22560
 
22561
 
22562
- function atfontface() {
22563
- const pos = position();
22564
- const m = match(/^@font-face\s*/);
22565
 
22566
- if (!m) {
22567
- return;
22568
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22569
 
22570
- if (!open()) {
22571
- return error("@font-face missing '{'");
22572
- }
 
 
 
 
 
 
 
22573
 
22574
- let decls = comments(); // declarations
 
 
22575
 
22576
- let decl; // eslint-disable-next-line no-cond-assign
 
22577
 
22578
- while (decl = declaration()) {
22579
- decls.push(decl);
22580
- decls = decls.concat(comments());
22581
  }
22582
 
22583
- if (!close()) {
22584
- return error("@font-face missing '}'");
22585
  }
22586
 
22587
- return pos({
22588
- type: 'font-face',
22589
- declarations: decls
22590
- });
22591
- }
22592
- /**
22593
- * Parse import
22594
- */
22595
-
22596
-
22597
- const atimport = _compileAtrule('import');
22598
- /**
22599
- * Parse charset
22600
- */
 
22601
 
 
 
22602
 
22603
- const atcharset = _compileAtrule('charset');
22604
- /**
22605
- * Parse namespace
22606
- */
 
 
22607
 
 
22608
 
22609
- const atnamespace = _compileAtrule('namespace');
22610
- /**
22611
- * Parse non-block at-rules
22612
- */
22613
 
 
 
 
 
 
 
 
 
 
22614
 
22615
- function _compileAtrule(name) {
22616
- const re = new RegExp('^@' + name + '\\s*([^;]+);');
22617
- return function () {
22618
- const pos = position();
22619
- const m = match(re);
22620
 
22621
- if (!m) {
22622
- return;
 
 
 
 
 
 
 
22623
  }
22624
 
22625
- const ret = {
22626
- type: name
 
 
 
 
22627
  };
22628
- ret[name] = m[1].trim();
22629
- return pos(ret);
22630
- };
22631
- }
22632
- /**
22633
- * Parse at rule.
22634
- */
22635
-
22636
-
22637
- function atrule() {
22638
- if (css[0] !== '@') {
22639
- return;
22640
  }
22641
 
22642
- return atkeyframes() || atmedia() || atcustommedia() || atsupports() || atimport() || atcharset() || atnamespace() || atdocument() || atpage() || athost() || atfontface();
22643
- }
22644
- /**
22645
- * Parse rule.
22646
- */
22647
-
22648
-
22649
- function rule() {
22650
- const pos = position();
22651
- const sel = selector();
22652
-
22653
- if (!sel) {
22654
- return error('selector missing');
22655
  }
22656
 
22657
- comments();
22658
- return pos({
22659
- type: 'rule',
22660
- selectors: sel,
22661
- declarations: declarations()
22662
- });
22663
- }
22664
-
22665
- return addParent(stylesheet());
22666
- }
22667
- /**
22668
- * Trim `str`.
22669
- */
22670
 
22671
- function trim(str) {
22672
- return str ? str.replace(/^\s+|\s+$/g, '') : '';
22673
- }
22674
- /**
22675
- * Adds non-enumerable parent node reference to each node.
22676
- */
22677
 
 
 
 
 
 
 
 
 
22678
 
22679
- function addParent(obj, parent) {
22680
- const isNode = obj && typeof obj.type === 'string';
22681
- const childParent = isNode ? obj : parent;
22682
 
22683
- for (const k in obj) {
22684
- const value = obj[k];
22685
 
22686
- if (Array.isArray(value)) {
22687
- value.forEach(function (v) {
22688
- addParent(v, childParent);
22689
- });
22690
- } else if (value && typeof value === 'object') {
22691
- addParent(value, childParent);
 
 
 
 
 
 
 
 
 
 
 
 
22692
  }
22693
- }
22694
-
22695
- if (isNode) {
22696
- Object.defineProperty(obj, 'parent', {
22697
- configurable: true,
22698
- writable: true,
22699
- enumerable: false,
22700
- value: parent || null
22701
- });
22702
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22703
 
22704
- return obj;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22705
  }
22706
- /* eslint-enable @wordpress/no-unused-vars-before-return */
22707
- //# sourceMappingURL=parse.js.map
22708
- // EXTERNAL MODULE: ./node_modules/inherits/inherits_browser.js
22709
- var inherits_browser = __webpack_require__(5717);
22710
- var inherits_browser_default = /*#__PURE__*/__webpack_require__.n(inherits_browser);
22711
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/transform-styles/ast/stringify/compiler.js
22712
- // Adapted from https://github.com/reworkcss/css
22713
- // because we needed to remove source map support.
22714
-
22715
- /**
22716
- * Expose `Compiler`.
22717
- */
22718
- /* harmony default export */ var compiler = (Compiler);
22719
- /**
22720
- * Initialize a compiler.
22721
- */
22722
 
22723
- function Compiler(opts) {
22724
- this.options = opts || {};
 
 
 
 
 
 
 
 
 
 
 
 
22725
  }
 
 
22726
  /**
22727
- * Emit `str`
22728
  */
22729
 
22730
 
22731
- Compiler.prototype.emit = function (str) {
22732
- return str;
22733
- };
22734
- /**
22735
- * Visit `node`.
22736
- */
22737
-
22738
 
22739
- Compiler.prototype.visit = function (node) {
22740
- return this[node.type](node);
22741
- };
22742
  /**
22743
- * Map visit over array of `nodes`, optionally using a `delim`
22744
  */
22745
 
22746
 
22747
- Compiler.prototype.mapVisit = function (nodes, delim) {
22748
- let buf = '';
22749
- delim = delim || '';
22750
-
22751
- for (let i = 0, length = nodes.length; i < length; i++) {
22752
- buf += this.visit(nodes[i]);
22753
 
22754
- if (delim && i < length - 1) {
22755
- buf += this.emit(delim);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22756
  }
22757
- }
22758
 
22759
- return buf;
22760
- };
22761
- //# sourceMappingURL=compiler.js.map
22762
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/transform-styles/ast/stringify/compress.js
22763
- // Adapted from https://github.com/reworkcss/css
22764
- // because we needed to remove source map support.
22765
 
22766
- /**
22767
- * External dependencies
22768
- */
22769
 
22770
- /**
22771
- * Internal dependencies
22772
- */
22773
 
 
 
 
 
22774
 
22775
- /**
22776
- * Expose compiler.
22777
- */
22778
 
22779
- /* harmony default export */ var compress = (compress_Compiler);
22780
- /**
22781
- * Initialize a new `Compiler`.
22782
- */
22783
 
22784
- function compress_Compiler(options) {
22785
- compiler.call(this, options);
22786
- }
22787
- /**
22788
- * Inherit from `Base.prototype`.
22789
- */
22790
 
22791
 
22792
- inherits_browser_default()(compress_Compiler, compiler);
22793
- /**
22794
- * Compile `node`.
22795
- */
22796
 
22797
- compress_Compiler.prototype.compile = function (node) {
22798
- return node.stylesheet.rules.map(this.visit, this).join('');
22799
- };
22800
- /**
22801
- * Visit comment node.
22802
- */
 
 
22803
 
 
 
 
 
22804
 
22805
- compress_Compiler.prototype.comment = function (node) {
22806
- return this.emit('', node.position);
22807
- };
22808
- /**
22809
- * Visit import node.
22810
- */
22811
 
 
 
22812
 
22813
- compress_Compiler.prototype.import = function (node) {
22814
- return this.emit('@import ' + node.import + ';', node.position);
22815
- };
22816
- /**
22817
- * Visit media node.
22818
- */
22819
 
22820
 
22821
- compress_Compiler.prototype.media = function (node) {
22822
- return this.emit('@media ' + node.media, node.position) + this.emit('{') + this.mapVisit(node.rules) + this.emit('}');
22823
- };
22824
- /**
22825
- * Visit document node.
22826
- */
22827
 
 
 
 
22828
 
22829
- compress_Compiler.prototype.document = function (node) {
22830
- const doc = '@' + (node.vendor || '') + 'document ' + node.document;
22831
- return this.emit(doc, node.position) + this.emit('{') + this.mapVisit(node.rules) + this.emit('}');
22832
- };
22833
- /**
22834
- * Visit charset node.
22835
- */
22836
 
 
 
 
 
22837
 
22838
- compress_Compiler.prototype.charset = function (node) {
22839
- return this.emit('@charset ' + node.charset + ';', node.position);
22840
- };
22841
- /**
22842
- * Visit namespace node.
22843
- */
22844
 
 
 
 
 
 
22845
 
22846
- compress_Compiler.prototype.namespace = function (node) {
22847
- return this.emit('@namespace ' + node.namespace + ';', node.position);
22848
- };
22849
- /**
22850
- * Visit supports node.
22851
- */
22852
 
 
 
22853
 
22854
- compress_Compiler.prototype.supports = function (node) {
22855
- return this.emit('@supports ' + node.supports, node.position) + this.emit('{') + this.mapVisit(node.rules) + this.emit('}');
22856
- };
22857
- /**
22858
- * Visit keyframes node.
22859
- */
22860
 
 
 
 
 
22861
 
22862
- compress_Compiler.prototype.keyframes = function (node) {
22863
- return this.emit('@' + (node.vendor || '') + 'keyframes ' + node.name, node.position) + this.emit('{') + this.mapVisit(node.keyframes) + this.emit('}');
22864
- };
22865
- /**
22866
- * Visit keyframe node.
22867
- */
22868
 
 
 
 
 
22869
 
22870
- compress_Compiler.prototype.keyframe = function (node) {
22871
- const decls = node.declarations;
22872
- return this.emit(node.values.join(','), node.position) + this.emit('{') + this.mapVisit(decls) + this.emit('}');
22873
- };
 
 
 
 
22874
  /**
22875
- * Visit page node.
22876
  */
22877
 
22878
 
22879
- compress_Compiler.prototype.page = function (node) {
22880
- const sel = node.selectors.length ? node.selectors.join(', ') : '';
22881
- return this.emit('@page ' + sel, node.position) + this.emit('{') + this.mapVisit(node.declarations) + this.emit('}');
22882
- };
22883
  /**
22884
- * Visit font-face node.
22885
  */
22886
 
22887
 
22888
- compress_Compiler.prototype['font-face'] = function (node) {
22889
- return this.emit('@font-face', node.position) + this.emit('{') + this.mapVisit(node.declarations) + this.emit('}');
22890
- };
22891
- /**
22892
- * Visit host node.
22893
- */
22894
 
 
 
 
 
 
 
22895
 
22896
- compress_Compiler.prototype.host = function (node) {
22897
- return this.emit('@host', node.position) + this.emit('{') + this.mapVisit(node.rules) + this.emit('}');
22898
- };
22899
- /**
22900
- * Visit custom-media node.
22901
- */
22902
 
 
 
 
 
22903
 
22904
- compress_Compiler.prototype['custom-media'] = function (node) {
22905
- return this.emit('@custom-media ' + node.name + ' ' + node.media + ';', node.position);
22906
- };
22907
- /**
22908
- * Visit rule node.
22909
- */
22910
 
 
 
 
 
 
 
22911
 
22912
- compress_Compiler.prototype.rule = function (node) {
22913
- const decls = node.declarations;
22914
 
22915
- if (!decls.length) {
22916
- return '';
22917
- }
22918
 
22919
- return this.emit(node.selectors.join(','), node.position) + this.emit('{') + this.mapVisit(decls) + this.emit('}');
22920
- };
22921
- /**
22922
- * Visit declaration node.
22923
- */
22924
 
 
22925
 
22926
- compress_Compiler.prototype.declaration = function (node) {
22927
- return this.emit(node.property + ':' + node.value, node.position) + this.emit(';');
22928
- };
22929
- //# sourceMappingURL=compress.js.map
22930
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/transform-styles/ast/stringify/identity.js
22931
- /* eslint-disable @wordpress/no-unused-vars-before-return */
22932
- // Adapted from https://github.com/reworkcss/css
22933
- // because we needed to remove source map support.
22934
 
 
 
 
 
 
 
 
22935
  /**
22936
- * External dependencies
22937
  */
22938
 
 
22939
  /**
22940
  * Internal dependencies
22941
  */
22942
 
22943
 
 
 
22944
  /**
22945
- * Expose compiler.
 
 
 
 
 
 
22946
  */
22947
 
22948
- /* harmony default export */ var identity = (identity_Compiler);
22949
  /**
22950
- * Initialize a new `Compiler`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22951
  */
22952
 
22953
- function identity_Compiler(options) {
22954
- options = options || {};
22955
- compiler.call(this, options);
22956
- this.indentation = options.indent;
22957
- }
22958
  /**
22959
- * Inherit from `Base.prototype`.
22960
  */
22961
 
22962
 
22963
- inherits_browser_default()(identity_Compiler, compiler);
22964
- /**
22965
- * Compile `node`.
22966
- */
22967
 
22968
- identity_Compiler.prototype.compile = function (node) {
22969
- return this.stylesheet(node);
22970
- };
22971
  /**
22972
- * Visit stylesheet node.
22973
  */
22974
 
22975
 
22976
- identity_Compiler.prototype.stylesheet = function (node) {
22977
- return this.mapVisit(node.stylesheet.rules, '\n\n');
22978
- };
22979
  /**
22980
- * Visit comment node.
 
 
 
 
 
 
 
 
 
 
 
 
22981
  */
22982
 
 
 
 
 
 
 
 
 
 
 
 
22983
 
22984
- identity_Compiler.prototype.comment = function (node) {
22985
- return this.emit(this.indent() + '/*' + node.comment + '*/', node.position);
22986
- };
22987
- /**
22988
- * Visit import node.
22989
- */
22990
 
 
 
 
22991
 
22992
- identity_Compiler.prototype.import = function (node) {
22993
- return this.emit('@import ' + node.import + ';', node.position);
22994
- };
22995
- /**
22996
- * Visit media node.
22997
- */
 
 
 
 
 
 
 
 
22998
 
 
 
 
 
 
22999
 
23000
- identity_Compiler.prototype.media = function (node) {
23001
- return this.emit('@media ' + node.media, node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(node.rules, '\n\n') + this.emit(this.indent(-1) + '\n}');
23002
- };
 
23003
  /**
23004
- * Visit document node.
23005
  */
23006
 
23007
 
23008
- identity_Compiler.prototype.document = function (node) {
23009
- const doc = '@' + (node.vendor || '') + 'document ' + node.document;
23010
- return this.emit(doc, node.position) + this.emit(' ' + ' {\n' + this.indent(1)) + this.mapVisit(node.rules, '\n\n') + this.emit(this.indent(-1) + '\n}');
23011
- };
23012
  /**
23013
- * Visit charset node.
 
 
 
 
23014
  */
23015
 
 
 
 
 
 
23016
 
23017
- identity_Compiler.prototype.charset = function (node) {
23018
- return this.emit('@charset ' + node.charset + ';', node.position);
23019
- };
23020
- /**
23021
- * Visit namespace node.
23022
- */
 
 
23023
 
 
 
 
 
 
23024
 
23025
- identity_Compiler.prototype.namespace = function (node) {
23026
- return this.emit('@namespace ' + node.namespace + ';', node.position);
23027
- };
23028
- /**
23029
- * Visit supports node.
23030
- */
 
 
 
 
23031
 
 
 
 
23032
 
23033
- identity_Compiler.prototype.supports = function (node) {
23034
- return this.emit('@supports ' + node.supports, node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(node.rules, '\n\n') + this.emit(this.indent(-1) + '\n}');
23035
- };
23036
- /**
23037
- * Visit keyframes node.
23038
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23039
 
 
 
 
 
 
23040
 
23041
- identity_Compiler.prototype.keyframes = function (node) {
23042
- return this.emit('@' + (node.vendor || '') + 'keyframes ' + node.name, node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(node.keyframes, '\n') + this.emit(this.indent(-1) + '}');
23043
- };
23044
- /**
23045
- * Visit keyframe node.
23046
- */
23047
 
23048
 
23049
- identity_Compiler.prototype.keyframe = function (node) {
23050
- const decls = node.declarations;
23051
- return this.emit(this.indent()) + this.emit(node.values.join(', '), node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(decls, '\n') + this.emit(this.indent(-1) + '\n' + this.indent() + '}\n');
23052
- };
23053
  /**
23054
- * Visit page node.
23055
  */
23056
 
23057
 
23058
- identity_Compiler.prototype.page = function (node) {
23059
- const sel = node.selectors.length ? node.selectors.join(', ') + ' ' : '';
23060
- return this.emit('@page ' + sel, node.position) + this.emit('{\n') + this.emit(this.indent(1)) + this.mapVisit(node.declarations, '\n') + this.emit(this.indent(-1)) + this.emit('\n}');
23061
- };
23062
- /**
23063
- * Visit font-face node.
23064
- */
23065
 
23066
 
23067
- identity_Compiler.prototype['font-face'] = function (node) {
23068
- return this.emit('@font-face ', node.position) + this.emit('{\n') + this.emit(this.indent(1)) + this.mapVisit(node.declarations, '\n') + this.emit(this.indent(-1)) + this.emit('\n}');
23069
- };
23070
  /**
23071
- * Visit host node.
23072
  */
23073
 
23074
 
23075
- identity_Compiler.prototype.host = function (node) {
23076
- return this.emit('@host', node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(node.rules, '\n\n') + this.emit(this.indent(-1) + '\n}');
23077
- };
23078
- /**
23079
- * Visit custom-media node.
23080
- */
23081
 
23082
 
23083
- identity_Compiler.prototype['custom-media'] = function (node) {
23084
- return this.emit('@custom-media ' + node.name + ' ' + node.media + ';', node.position);
23085
- };
23086
- /**
23087
- * Visit rule node.
23088
- */
23089
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23090
 
23091
- identity_Compiler.prototype.rule = function (node) {
23092
- const indent = this.indent();
23093
- const decls = node.declarations;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23094
 
23095
- if (!decls.length) {
23096
- return '';
 
 
 
 
 
 
 
 
 
 
23097
  }
23098
 
23099
- return this.emit(node.selectors.map(function (s) {
23100
- return indent + s;
23101
- }).join(',\n'), node.position) + this.emit(' {\n') + this.emit(this.indent(1)) + this.mapVisit(decls, '\n') + this.emit(this.indent(-1)) + this.emit('\n' + this.indent() + '}');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23102
  };
 
 
 
 
 
 
 
23103
  /**
23104
- * Visit declaration node.
23105
  */
23106
 
23107
-
23108
- identity_Compiler.prototype.declaration = function (node) {
23109
- return this.emit(this.indent()) + this.emit(node.property + ': ' + node.value, node.position) + this.emit(';');
23110
- };
23111
  /**
23112
- * Increase, decrease or return current indentation.
23113
  */
23114
 
23115
 
23116
- identity_Compiler.prototype.indent = function (level) {
23117
- this.level = this.level || 1;
23118
 
23119
- if (null !== level) {
23120
- this.level += level;
23121
- return '';
23122
- }
23123
 
23124
- return Array(this.level).join(this.indentation || ' ');
23125
- };
23126
- /* eslint-enable @wordpress/no-unused-vars-before-return */
23127
- //# sourceMappingURL=identity.js.map
23128
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/transform-styles/ast/stringify/index.js
23129
- // Adapted from https://github.com/reworkcss/css
23130
- // because we needed to remove source map support.
23131
 
23132
- /**
23133
- * Internal dependencies
23134
- */
23135
 
23136
 
23137
- /**
23138
- * Stringfy the given AST `node`.
23139
- *
23140
- * Options:
23141
- *
23142
- * - `compress` space-optimized output
23143
- * - `sourcemap` return an object with `.code` and `.map`
23144
- *
23145
- * @param {Object} node
23146
- * @param {Object} [options]
23147
- * @return {string}
23148
- */
23149
 
23150
- /* harmony default export */ function stringify(node, options) {
23151
- options = options || {};
23152
- const compiler = options.compress ? new compress(options) : new identity(options);
23153
- const code = compiler.compile(node);
23154
- return code;
23155
- }
23156
- //# sourceMappingURL=index.js.map
23157
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/transform-styles/traverse.js
23158
- /**
23159
- * External dependencies
23160
- */
23161
 
23162
  /**
23163
  * Internal dependencies
@@ -23165,588 +22830,754 @@ identity_Compiler.prototype.indent = function (level) {
23165
 
23166
 
23167
 
23168
- function traverseCSS(css, callback) {
23169
- try {
23170
- const parsed = parse(css);
23171
- const updated = traverse_default().map(parsed, function (node) {
23172
- if (!node) {
23173
- return node;
23174
- }
23175
 
23176
- const updatedNode = callback(node);
23177
- return this.update(updatedNode);
23178
- });
23179
- return stringify(updated);
23180
- } catch (err) {
23181
- // eslint-disable-next-line no-console
23182
- console.warn('Error while traversing the CSS: ' + err);
23183
- return null;
23184
- }
23185
- }
23186
 
23187
- /* harmony default export */ var transform_styles_traverse = (traverseCSS);
23188
- //# sourceMappingURL=traverse.js.map
23189
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/transform-styles/transforms/url-rewrite.js
23190
- /**
23191
- * Return `true` if the given path is http/https.
23192
- *
23193
- * @param {string} filePath path
23194
- *
23195
- * @return {boolean} is remote path.
23196
- */
23197
- function isRemotePath(filePath) {
23198
- return /^(?:https?:)?\/\//.test(filePath);
23199
- }
23200
  /**
23201
- * Return `true` if the given filePath is an absolute url.
 
 
23202
  *
23203
- * @param {string} filePath path
 
23204
  *
23205
- * @return {boolean} is absolute path.
23206
  */
23207
 
 
 
 
 
 
 
 
 
23208
 
23209
- function isAbsolutePath(filePath) {
23210
- return /^\/(?!\/)/.test(filePath);
23211
- }
23212
- /**
23213
- * Whether or not the url should be inluded.
23214
- *
23215
- * @param {Object} meta url meta info
23216
- *
23217
- * @return {boolean} is valid.
23218
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23219
 
 
23220
 
23221
- function isValidURL(meta) {
23222
- // ignore hashes or data uris
23223
- if (meta.value.indexOf('data:') === 0 || meta.value.indexOf('#') === 0) {
23224
- return false;
23225
- }
23226
 
23227
- if (isAbsolutePath(meta.value)) {
23228
- return false;
23229
- } // do not handle the http/https urls if `includeRemote` is false
 
 
 
23230
 
 
 
 
23231
 
23232
- if (isRemotePath(meta.value)) {
23233
- return false;
23234
- }
23235
 
23236
- return true;
23237
- }
23238
- /**
23239
- * Get the absolute path of the url, relative to the basePath
23240
- *
23241
- * @param {string} str the url
23242
- * @param {string} baseURL base URL
23243
- *
23244
- * @return {string} the full path to the file
23245
- */
23246
 
 
 
 
 
23247
 
23248
- function getResourcePath(str, baseURL) {
23249
- return new URL(str, baseURL).toString();
23250
- }
23251
- /**
23252
- * Process the single `url()` pattern
23253
- *
23254
- * @param {string} baseURL the base URL for relative URLs.
23255
- *
23256
- * @return {Promise} the Promise.
23257
- */
23258
 
 
 
 
23259
 
23260
- function processURL(baseURL) {
23261
- return meta => ({ ...meta,
23262
- newUrl: 'url(' + meta.before + meta.quote + getResourcePath(meta.value, baseURL) + meta.quote + meta.after + ')'
23263
- });
23264
- }
23265
- /**
23266
- * Get all `url()`s, and return the meta info
23267
- *
23268
- * @param {string} value decl.value.
23269
- *
23270
- * @return {Array} the urls.
23271
- */
23272
 
 
 
 
 
 
 
23273
 
23274
- function getURLs(value) {
23275
- const reg = /url\((\s*)(['"]?)(.+?)\2(\s*)\)/g;
23276
- let match;
23277
- const URLs = [];
23278
 
23279
- while ((match = reg.exec(value)) !== null) {
23280
- const meta = {
23281
- source: match[0],
23282
- before: match[1],
23283
- quote: match[2],
23284
- value: match[3],
23285
- after: match[4]
23286
- };
23287
 
23288
- if (isValidURL(meta)) {
23289
- URLs.push(meta);
 
 
 
 
23290
  }
23291
  }
23292
 
23293
- return URLs;
23294
- }
23295
- /**
23296
- * Replace the raw value's `url()` segment to the new value
23297
- *
23298
- * @param {string} raw the raw value.
23299
- * @param {Array} URLs the URLs to replace.
23300
- *
23301
- * @return {string} the new value.
23302
- */
23303
 
 
23304
 
23305
- function replaceURLs(raw, URLs) {
23306
- URLs.forEach(item => {
23307
- raw = raw.replace(item.source, item.newUrl);
23308
- });
23309
- return raw;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23310
  }
23311
 
23312
- const rewrite = rootURL => node => {
23313
- if (node.type === 'declaration') {
23314
- const updatedURLs = getURLs(node.value).map(processURL(rootURL));
23315
- return { ...node,
23316
- value: replaceURLs(node.value, updatedURLs)
23317
- };
23318
- }
23319
 
23320
- return node;
23321
- };
23322
 
23323
- /* harmony default export */ var url_rewrite = (rewrite);
23324
- //# sourceMappingURL=url-rewrite.js.map
23325
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/transform-styles/transforms/wrap.js
23326
  /**
23327
- * @constant string IS_ROOT_TAG Regex to check if the selector is a root tag selector.
23328
  */
23329
- const IS_ROOT_TAG = /^(body|html|:root).*$/;
23330
 
23331
- const wrap = (namespace, ignore = []) => node => {
23332
- const updateSelector = selector => {
23333
- if (ignore.includes(selector.trim())) {
23334
- return selector;
23335
- } // Anything other than a root tag is always prefixed.
23336
 
23337
 
23338
- {
23339
- if (!selector.match(IS_ROOT_TAG)) {
23340
- return namespace + ' ' + selector;
23341
- }
23342
- } // HTML and Body elements cannot be contained within our container so lets extract their styles.
23343
 
23344
- return selector.replace(/^(body|html|:root)/, namespace);
23345
- };
23346
 
23347
- if (node.type === 'rule') {
23348
- return { ...node,
23349
- selectors: node.selectors.map(updateSelector)
23350
- };
23351
- }
23352
 
23353
- return node;
23354
- };
 
 
23355
 
23356
- /* harmony default export */ var transforms_wrap = (wrap);
23357
- //# sourceMappingURL=wrap.js.map
23358
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/transform-styles/index.js
23359
- /**
23360
- * External dependencies
23361
- */
23362
 
23363
- /**
23364
- * WordPress dependencies
23365
- */
23366
 
 
 
23367
 
23368
- /**
23369
- * Internal dependencies
23370
- */
 
23371
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23372
 
 
 
 
 
23373
 
 
 
 
 
 
 
 
23374
 
23375
- /**
23376
- * Applies a series of CSS rule transforms to wrap selectors inside a given class and/or rewrite URLs depending on the parameters passed.
23377
- *
23378
- * @param {Array} styles CSS rules.
23379
- * @param {string} wrapperClassName Wrapper Class Name.
23380
- * @return {Array} converted rules.
23381
- */
 
 
 
 
 
 
 
23382
 
23383
- const transformStyles = (styles, wrapperClassName = '') => {
23384
- return (0,external_lodash_namespaceObject.map)(styles, ({
23385
- css,
23386
- baseURL,
23387
- __experimentalNoWrapper = false
23388
- }) => {
23389
- const transforms = [];
23390
 
23391
- if (wrapperClassName && !__experimentalNoWrapper) {
23392
- transforms.push(transforms_wrap(wrapperClassName));
 
 
23393
  }
 
 
 
 
 
 
 
23394
 
23395
- if (baseURL) {
23396
- transforms.push(url_rewrite(baseURL));
23397
- }
 
23398
 
23399
- if (transforms.length) {
23400
- return transform_styles_traverse(css, (0,external_wp_compose_namespaceObject.compose)(transforms));
 
 
23401
  }
23402
 
23403
- return css;
23404
- });
23405
- };
 
23406
 
23407
- /* harmony default export */ var transform_styles = (transformStyles);
23408
- //# sourceMappingURL=index.js.map
23409
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/editor-styles/index.js
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23410
 
 
 
 
 
 
 
23411
 
23412
- /**
23413
- * External dependencies
23414
- */
 
 
 
23415
 
 
 
 
23416
 
23417
 
23418
  /**
23419
  * WordPress dependencies
23420
  */
23421
 
 
 
 
 
 
 
 
 
 
 
23422
 
23423
  /**
23424
- * Internal dependencies
23425
  */
23426
 
 
 
 
 
 
 
 
 
 
23427
 
23428
- const EDITOR_STYLES_SELECTOR = '.editor-styles-wrapper';
23429
- k([names, a11y]);
23430
-
23431
- function useDarkThemeBodyClassName(styles) {
23432
- return (0,external_wp_element_namespaceObject.useCallback)(node => {
23433
- if (!node) {
23434
- return;
23435
- }
23436
-
23437
- const {
23438
- ownerDocument
23439
- } = node;
23440
- const {
23441
- defaultView,
23442
- body
23443
- } = ownerDocument;
23444
- const canvas = ownerDocument.querySelector(EDITOR_STYLES_SELECTOR);
23445
- let backgroundColor;
23446
-
23447
- if (!canvas) {
23448
- // The real .editor-styles-wrapper element might not exist in the
23449
- // DOM, so calculate the background color by creating a fake
23450
- // wrapper.
23451
- const tempCanvas = ownerDocument.createElement('div');
23452
- tempCanvas.classList.add('editor-styles-wrapper');
23453
- body.appendChild(tempCanvas);
23454
- backgroundColor = defaultView.getComputedStyle(tempCanvas, null).getPropertyValue('background-color');
23455
- body.removeChild(tempCanvas);
23456
- } else {
23457
- backgroundColor = defaultView.getComputedStyle(canvas, null).getPropertyValue('background-color');
23458
- }
23459
-
23460
- const colordBackgroundColor = w(backgroundColor); // If background is transparent, it should be treated as light color.
23461
 
23462
- if (colordBackgroundColor.luminance() > 0.5 || colordBackgroundColor.alpha() === 0) {
23463
- body.classList.remove('is-dark-theme');
23464
- } else {
23465
- body.classList.add('is-dark-theme');
23466
- }
23467
- }, [styles]);
23468
- }
23469
 
23470
- function EditorStyles({
23471
- styles
23472
- }) {
23473
- const transformedStyles = (0,external_wp_element_namespaceObject.useMemo)(() => transform_styles(styles, EDITOR_STYLES_SELECTOR), [styles]);
23474
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("style", {
23475
- ref: useDarkThemeBodyClassName(styles)
23476
- }), transformedStyles.map((css, index) => (0,external_wp_element_namespaceObject.createElement)("style", {
23477
- key: index
23478
- }, css)));
23479
- }
23480
- //# sourceMappingURL=index.js.map
23481
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-preview/auto.js
23482
 
23483
 
23484
  /**
23485
  * WordPress dependencies
23486
  */
23487
 
23488
-
 
 
 
 
 
 
 
 
 
 
 
23489
 
23490
  /**
23491
- * Internal dependencies
 
 
 
 
 
 
 
 
 
 
 
 
 
23492
  */
23493
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23494
 
 
 
23495
 
 
 
23496
 
23497
- // This is used to avoid rendering the block list if the sizes change.
 
 
23498
 
23499
- let MemoizedBlockList;
 
 
 
23500
 
23501
- function AutoBlockPreview({
23502
- viewportWidth,
23503
- __experimentalPadding
23504
- }) {
23505
- const [containerResizeListener, {
23506
- width: containerWidth
23507
- }] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
23508
- const [contentResizeListener, {
23509
- height: contentHeight
23510
- }] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
23511
- const styles = (0,external_wp_data_namespaceObject.useSelect)(select => {
23512
- return select(store).getSettings().styles;
23513
- }, []); // Initialize on render instead of module top level, to avoid circular dependency issues.
23514
 
23515
- MemoizedBlockList = MemoizedBlockList || (0,external_wp_compose_namespaceObject.pure)(BlockList);
23516
- const scale = containerWidth / viewportWidth;
23517
- return (0,external_wp_element_namespaceObject.createElement)("div", {
23518
- className: "block-editor-block-preview__container"
23519
- }, containerResizeListener, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Disabled, {
23520
- className: "block-editor-block-preview__content",
23521
- style: {
23522
- transform: `scale(${scale})`,
23523
- height: contentHeight * scale
23524
  }
23525
- }, (0,external_wp_element_namespaceObject.createElement)(iframe, {
23526
- head: (0,external_wp_element_namespaceObject.createElement)(EditorStyles, {
23527
- styles: styles
23528
- }),
23529
- contentRef: (0,external_wp_compose_namespaceObject.useRefEffect)(bodyElement => {
23530
- const {
23531
- ownerDocument: {
23532
- documentElement
23533
- }
23534
- } = bodyElement;
23535
- documentElement.style.position = 'absolute';
23536
- documentElement.style.width = '100%';
23537
- bodyElement.style.padding = __experimentalPadding + 'px';
23538
- }, []),
23539
- "aria-hidden": true,
23540
- tabIndex: -1,
23541
- style: {
23542
- position: 'absolute',
23543
- width: viewportWidth,
23544
- height: contentHeight,
23545
- pointerEvents: 'none'
23546
  }
23547
- }, contentResizeListener, (0,external_wp_element_namespaceObject.createElement)(MemoizedBlockList, {
23548
- renderAppender: false
23549
- }))));
23550
- }
23551
 
23552
- /* harmony default export */ var auto = (AutoBlockPreview);
23553
- //# sourceMappingURL=auto.js.map
23554
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-preview/index.js
 
 
23555
 
 
 
 
23556
 
23557
- /**
23558
- * External dependencies
23559
- */
 
23560
 
23561
- /**
23562
- * WordPress dependencies
23563
- */
 
23564
 
 
 
 
 
 
23565
 
 
 
 
23566
 
23567
- /**
23568
- * Internal dependencies
23569
- */
 
23570
 
 
 
 
 
23571
 
 
 
 
 
 
23572
 
 
 
 
23573
 
 
 
 
 
23574
 
23575
- function BlockPreview({
23576
- blocks,
23577
- __experimentalPadding = 0,
23578
- viewportWidth = 1200,
23579
- __experimentalLive = false,
23580
- __experimentalOnClick
23581
- }) {
23582
- const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings(), []);
23583
- const settings = (0,external_wp_element_namespaceObject.useMemo)(() => {
23584
- const _settings = { ...originalSettings
23585
- };
23586
- _settings.__experimentalBlockPatterns = [];
23587
- return _settings;
23588
- }, [originalSettings]);
23589
- const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_lodash_namespaceObject.castArray)(blocks), [blocks]);
23590
 
23591
- if (!blocks || blocks.length === 0) {
23592
- return null;
 
 
23593
  }
23594
-
23595
- return (0,external_wp_element_namespaceObject.createElement)(provider, {
23596
- value: renderedBlocks,
23597
- settings: settings
23598
- }, __experimentalLive ? (0,external_wp_element_namespaceObject.createElement)(LiveBlockPreview, {
23599
- onClick: __experimentalOnClick
23600
- }) : (0,external_wp_element_namespaceObject.createElement)(auto, {
23601
- viewportWidth: viewportWidth,
23602
- __experimentalPadding: __experimentalPadding
23603
- }));
23604
  }
23605
  /**
23606
- * BlockPreview renders a preview of a block or array of blocks.
23607
- *
23608
- * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-preview/README.md
23609
  *
23610
- * @param {Object} preview options for how the preview should be shown
23611
- * @param {Array|Object} preview.blocks A block instance (object) or an array of blocks to be previewed.
23612
- * @param {number} preview.viewportWidth Width of the preview container in pixels. Controls at what size the blocks will be rendered inside the preview. Default: 700.
 
 
 
23613
  *
23614
- * @return {WPComponent} The component to be rendered.
23615
  */
23616
 
23617
- /* harmony default export */ var block_preview = ((0,external_wp_element_namespaceObject.memo)(BlockPreview));
23618
- //# sourceMappingURL=index.js.map
23619
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/preview-panel.js
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23620
 
23621
 
23622
  /**
23623
- * WordPress dependencies
23624
  */
23625
 
23626
 
23627
  /**
23628
- * Internal dependencies
23629
  */
23630
 
23631
 
23632
 
23633
 
23634
- function InserterPreviewPanel({
23635
- item
23636
- }) {
23637
- var _hoveredItemBlockType, _hoveredItemBlockType2;
23638
 
23639
- const {
23640
- name,
23641
- title,
23642
- icon,
23643
- description,
23644
- initialAttributes
23645
- } = item;
23646
- const hoveredItemBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
23647
- const isReusable = (0,external_wp_blocks_namespaceObject.isReusableBlock)(item);
23648
- return (0,external_wp_element_namespaceObject.createElement)("div", {
23649
- className: "block-editor-inserter__preview-container"
23650
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
23651
- className: "block-editor-inserter__preview"
23652
- }, isReusable || hoveredItemBlockType.example ? (0,external_wp_element_namespaceObject.createElement)("div", {
23653
- className: "block-editor-inserter__preview-content"
23654
- }, (0,external_wp_element_namespaceObject.createElement)(block_preview, {
23655
- __experimentalPadding: 16,
23656
- viewportWidth: (_hoveredItemBlockType = (_hoveredItemBlockType2 = hoveredItemBlockType.example) === null || _hoveredItemBlockType2 === void 0 ? void 0 : _hoveredItemBlockType2.viewportWidth) !== null && _hoveredItemBlockType !== void 0 ? _hoveredItemBlockType : 500,
23657
- blocks: hoveredItemBlockType.example ? (0,external_wp_blocks_namespaceObject.getBlockFromExample)(item.name, {
23658
- attributes: { ...hoveredItemBlockType.example.attributes,
23659
- ...initialAttributes
23660
- },
23661
- innerBlocks: hoveredItemBlockType.example.innerBlocks
23662
- }) : (0,external_wp_blocks_namespaceObject.createBlock)(name, initialAttributes)
23663
- })) : (0,external_wp_element_namespaceObject.createElement)("div", {
23664
- className: "block-editor-inserter__preview-content-missing"
23665
- }, (0,external_wp_i18n_namespaceObject.__)('No Preview Available.'))), !isReusable && (0,external_wp_element_namespaceObject.createElement)(block_card, {
23666
- title: title,
23667
- icon: icon,
23668
- description: description
23669
- }));
23670
- }
23671
 
23672
- /* harmony default export */ var preview_panel = (InserterPreviewPanel);
23673
- //# sourceMappingURL=preview-panel.js.map
23674
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter-listbox/context.js
23675
  /**
23676
- * WordPress dependencies
23677
  */
23678
 
23679
- const InserterListboxContext = (0,external_wp_element_namespaceObject.createContext)();
23680
- /* harmony default export */ var context = (InserterListboxContext);
23681
- //# sourceMappingURL=context.js.map
23682
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter-listbox/item.js
23683
 
23684
 
23685
 
23686
- /**
23687
- * WordPress dependencies
23688
- */
23689
 
 
 
 
 
 
23690
 
23691
- /**
23692
- * Internal dependencies
23693
- */
 
 
23694
 
 
 
23695
 
 
 
23696
 
23697
- function InserterListboxItem({
23698
- isFirst,
23699
- as: Component,
23700
- children,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23701
  ...props
23702
- }, ref) {
23703
- const state = (0,external_wp_element_namespaceObject.useContext)(context);
23704
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableCompositeItem, _extends({
23705
- ref: ref,
23706
- state: state,
23707
- role: "option" // Use the CompositeItem `focusable` prop over Button's
23708
- // isFocusable. The latter was shown to cause an issue
23709
- // with tab order in the inserter list.
23710
- ,
23711
- focusable: true
23712
- }, props), htmlProps => {
23713
- const propsWithTabIndex = { ...htmlProps,
23714
- tabIndex: isFirst ? 0 : htmlProps.tabIndex
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23715
  };
 
 
 
 
 
 
23716
 
23717
- if (Component) {
23718
- return (0,external_wp_element_namespaceObject.createElement)(Component, propsWithTabIndex, children);
23719
- }
23720
 
23721
- if (typeof children === 'function') {
23722
- return children(propsWithTabIndex);
23723
  }
 
23724
 
23725
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, propsWithTabIndex, children);
23726
- });
23727
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23728
 
23729
- /* harmony default export */ var inserter_listbox_item = ((0,external_wp_element_namespaceObject.forwardRef)(InserterListboxItem));
23730
- //# sourceMappingURL=item.js.map
23731
- ;// CONCATENATED MODULE: ./packages/icons/build-module/library/drag-handle.js
23732
 
23733
 
23734
  /**
23735
- * WordPress dependencies
23736
  */
23737
 
23738
- const dragHandle = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
23739
- width: "18",
23740
- height: "18",
23741
- xmlns: "http://www.w3.org/2000/svg",
23742
- viewBox: "0 0 18 18"
23743
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
23744
- d: "M5 4h2V2H5v2zm6-2v2h2V2h-2zm-6 8h2V8H5v2zm6 0h2V8h-2v2zm-6 6h2v-2H5v2zm6 0h2v-2h-2v2z"
23745
- }));
23746
- /* harmony default export */ var drag_handle = (dragHandle);
23747
- //# sourceMappingURL=drag-handle.js.map
23748
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-draggable/draggable-chip.js
23749
-
23750
 
23751
  /**
23752
  * WordPress dependencies
@@ -23754,79 +23585,109 @@ const dragHandle = (0,external_wp_element_namespaceObject.createElement)(externa
23754
 
23755
 
23756
 
 
 
 
 
23757
  /**
23758
  * Internal dependencies
23759
  */
23760
 
23761
 
23762
- function BlockDraggableChip({
23763
- count,
23764
- icon
 
 
 
 
 
 
 
 
 
23765
  }) {
23766
- return (0,external_wp_element_namespaceObject.createElement)("div", {
23767
- className: "block-editor-block-draggable-chip-wrapper"
23768
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
23769
- className: "block-editor-block-draggable-chip"
23770
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
23771
- justify: "center",
23772
- className: "block-editor-block-draggable-chip__content"
23773
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, icon ? (0,external_wp_element_namespaceObject.createElement)(BlockIcon, {
23774
- icon: icon
23775
- }) : (0,external_wp_i18n_namespaceObject.sprintf)(
23776
- /* translators: %d: Number of blocks. */
23777
- (0,external_wp_i18n_namespaceObject._n)('%d block', '%d blocks', count), count)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(BlockIcon, {
23778
- icon: drag_handle
23779
- })))));
23780
- }
23781
- //# sourceMappingURL=draggable-chip.js.map
23782
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter-draggable-blocks/index.js
23783
 
 
23784
 
23785
- /**
23786
- * WordPress dependencies
23787
- */
23788
 
23789
- /**
23790
- * Internal dependencies
23791
- */
23792
 
 
 
 
 
23793
 
23794
 
23795
- const InserterDraggableBlocks = ({
23796
- isEnabled,
23797
- blocks,
23798
- icon,
23799
- children
23800
- }) => {
23801
- const transferData = {
23802
- type: 'inserter',
23803
- blocks
23804
- };
23805
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Draggable, {
23806
- __experimentalTransferDataType: "wp-blocks",
23807
- transferData: transferData,
23808
- __experimentalDragComponent: (0,external_wp_element_namespaceObject.createElement)(BlockDraggableChip, {
23809
- count: blocks.length,
23810
- icon: icon
23811
  })
23812
- }, ({
23813
- onDraggableStart,
23814
- onDraggableEnd
23815
- }) => {
23816
- return children({
23817
- draggable: isEnabled,
23818
- onDragStart: isEnabled ? onDraggableStart : undefined,
23819
- onDragEnd: isEnabled ? onDraggableEnd : undefined
23820
- });
23821
- });
23822
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23823
 
23824
- /* harmony default export */ var inserter_draggable_blocks = (InserterDraggableBlocks);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23825
  //# sourceMappingURL=index.js.map
23826
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter-list-item/index.js
23827
-
23828
-
23829
-
23830
  /**
23831
  * External dependencies
23832
  */
@@ -23836,160 +23697,164 @@ const InserterDraggableBlocks = ({
23836
  */
23837
 
23838
 
23839
-
23840
-
 
 
 
23841
  /**
23842
- * Internal dependencies
 
 
 
 
 
 
23843
  */
23844
 
 
 
 
 
 
 
 
 
23845
 
 
 
 
 
23846
 
 
 
23847
 
23848
- /**
23849
- * Return true if platform is MacOS.
23850
- *
23851
- * @param {Object} _window window object by default; used for DI testing.
23852
- *
23853
- * @return {boolean} True if MacOS; false otherwise.
23854
- */
23855
 
23856
- function isAppleOS(_window = window) {
23857
- const {
23858
- platform
23859
- } = _window.navigator;
23860
- return platform.indexOf('Mac') !== -1 || ['iPad', 'iPhone'].includes(platform);
23861
- }
23862
 
23863
- function InserterListItem({
23864
- className,
23865
- isFirst,
23866
- item,
23867
- onSelect,
23868
- onHover,
23869
- isDraggable,
23870
- ...props
23871
- }) {
23872
- const isDragging = (0,external_wp_element_namespaceObject.useRef)(false);
23873
- const itemIconStyle = item.icon ? {
23874
- backgroundColor: item.icon.background,
23875
- color: item.icon.foreground
23876
- } : {};
23877
- const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => {
23878
- return [(0,external_wp_blocks_namespaceObject.createBlock)(item.name, item.initialAttributes, (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(item.innerBlocks))];
23879
- }, [item.name, item.initialAttributes, item.initialAttributes]);
23880
- return (0,external_wp_element_namespaceObject.createElement)(inserter_draggable_blocks, {
23881
- isEnabled: isDraggable && !item.disabled,
23882
- blocks: blocks,
23883
- icon: item.icon
23884
- }, ({
23885
- draggable,
23886
- onDragStart,
23887
- onDragEnd
23888
- }) => (0,external_wp_element_namespaceObject.createElement)("div", {
23889
- className: "block-editor-block-types-list__list-item",
23890
- draggable: draggable,
23891
- onDragStart: event => {
23892
- isDragging.current = true;
23893
 
23894
- if (onDragStart) {
23895
- onHover(null);
23896
- onDragStart(event);
23897
- }
23898
- },
23899
- onDragEnd: event => {
23900
- isDragging.current = false;
23901
 
23902
- if (onDragEnd) {
23903
- onDragEnd(event);
23904
- }
23905
  }
23906
- }, (0,external_wp_element_namespaceObject.createElement)(inserter_listbox_item, _extends({
23907
- isFirst: isFirst,
23908
- className: classnames_default()('block-editor-block-types-list__item', className),
23909
- disabled: item.isDisabled,
23910
- onClick: event => {
23911
- event.preventDefault();
23912
- onSelect(item, isAppleOS() ? event.metaKey : event.ctrlKey);
23913
- onHover(null);
23914
- },
23915
- onKeyDown: event => {
23916
- const {
23917
- keyCode
23918
- } = event;
23919
 
23920
- if (keyCode === external_wp_keycodes_namespaceObject.ENTER) {
23921
- event.preventDefault();
23922
- onSelect(item, isAppleOS() ? event.metaKey : event.ctrlKey);
23923
- onHover(null);
23924
- }
23925
- },
23926
- onFocus: () => {
23927
- if (isDragging.current) {
23928
- return;
23929
- }
23930
 
23931
- onHover(item);
23932
- },
23933
- onMouseEnter: () => {
23934
- if (isDragging.current) {
23935
- return;
 
 
 
 
 
 
 
 
 
23936
  }
 
 
23937
 
23938
- onHover(item);
23939
- },
23940
- onMouseLeave: () => onHover(null),
23941
- onBlur: () => onHover(null)
23942
- }, props), (0,external_wp_element_namespaceObject.createElement)("span", {
23943
- className: "block-editor-block-types-list__item-icon",
23944
- style: itemIconStyle
23945
- }, (0,external_wp_element_namespaceObject.createElement)(BlockIcon, {
23946
- icon: item.icon,
23947
- showColors: true
23948
- })), (0,external_wp_element_namespaceObject.createElement)("span", {
23949
- className: "block-editor-block-types-list__item-title"
23950
- }, item.title))));
23951
  }
 
 
 
 
 
 
 
 
 
23952
 
23953
- /* harmony default export */ var inserter_list_item = ((0,external_wp_element_namespaceObject.memo)(InserterListItem));
23954
- //# sourceMappingURL=index.js.map
23955
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter-listbox/group.js
23956
-
 
 
 
 
 
 
 
 
 
 
 
 
 
23957
 
 
 
 
23958
 
23959
- /**
23960
- * WordPress dependencies
23961
- */
23962
 
 
 
 
 
 
 
23963
 
 
 
 
 
 
 
 
 
 
 
23964
 
23965
 
23966
- function InserterListboxGroup(props, ref) {
23967
- const [shouldSpeak, setShouldSpeak] = (0,external_wp_element_namespaceObject.useState)(false);
23968
- (0,external_wp_element_namespaceObject.useEffect)(() => {
23969
- if (shouldSpeak) {
23970
- (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Use left and right arrow keys to move through blocks'));
23971
  }
23972
- }, [shouldSpeak]);
23973
- return (0,external_wp_element_namespaceObject.createElement)("div", _extends({
23974
- ref: ref,
23975
- role: "listbox",
23976
- "aria-orientation": "horizontal",
23977
- onFocus: () => {
23978
- setShouldSpeak(true);
23979
- },
23980
- onBlur: event => {
23981
- const focusingOutsideGroup = !event.currentTarget.contains(event.relatedTarget);
23982
 
23983
- if (focusingOutsideGroup) {
23984
- setShouldSpeak(false);
 
 
23985
  }
 
 
 
 
 
 
 
23986
  }
23987
- }, props));
23988
  }
23989
-
23990
- /* harmony default export */ var group = ((0,external_wp_element_namespaceObject.forwardRef)(InserterListboxGroup));
23991
- //# sourceMappingURL=group.js.map
23992
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter-listbox/row.js
23993
 
23994
 
23995
 
@@ -23998,74 +23863,113 @@ function InserterListboxGroup(props, ref) {
23998
  */
23999
 
24000
 
 
 
 
24001
  /**
24002
  * Internal dependencies
24003
  */
24004
 
24005
 
24006
 
24007
- function InserterListboxRow(props, ref) {
24008
- const state = (0,external_wp_element_namespaceObject.useContext)(context);
24009
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableCompositeGroup, _extends({
24010
- state: state,
24011
- role: "presentation",
24012
- ref: ref
24013
- }, props));
24014
- }
24015
-
24016
- /* harmony default export */ var inserter_listbox_row = ((0,external_wp_element_namespaceObject.forwardRef)(InserterListboxRow));
24017
- //# sourceMappingURL=row.js.map
24018
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-types-list/index.js
24019
 
24020
 
24021
  /**
24022
- * WordPress dependencies
 
 
 
24023
  */
24024
 
24025
- /**
24026
- * Internal dependencies
24027
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24028
 
 
 
 
 
 
24029
 
 
 
 
 
24030
 
 
 
24031
 
24032
- function chunk(array, size) {
24033
- const chunks = [];
24034
 
24035
- for (let i = 0, j = array.length; i < j; i += size) {
24036
- chunks.push(array.slice(i, i + size));
24037
  }
24038
 
24039
- return chunks;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24040
  }
 
 
24041
 
24042
- function BlockTypesList({
24043
- items = [],
24044
- onSelect,
24045
- onHover = () => {},
24046
- children,
24047
- label,
24048
- isDraggable = true
24049
- }) {
24050
- return (0,external_wp_element_namespaceObject.createElement)(group, {
24051
- className: "block-editor-block-types-list",
24052
- "aria-label": label
24053
- }, chunk(items, 3).map((row, i) => (0,external_wp_element_namespaceObject.createElement)(inserter_listbox_row, {
24054
- key: i
24055
- }, row.map((item, j) => (0,external_wp_element_namespaceObject.createElement)(inserter_list_item, {
24056
- key: item.id,
24057
- item: item,
24058
- className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(item.id),
24059
- onSelect: onSelect,
24060
- onHover: onHover,
24061
- isDraggable: isDraggable,
24062
- isFirst: i === 0 && j === 0
24063
- })))), children);
24064
- }
24065
 
24066
- /* harmony default export */ var block_types_list = (BlockTypesList);
24067
- //# sourceMappingURL=index.js.map
24068
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/panel.js
 
 
 
 
 
 
 
 
 
 
24069
 
24070
 
24071
  /**
@@ -24073,113 +23977,156 @@ function BlockTypesList({
24073
  */
24074
 
24075
 
24076
- function InserterPanel({
24077
- title,
24078
- icon,
24079
- children
 
 
 
24080
  }) {
24081
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
24082
- className: "block-editor-inserter__panel-header"
24083
- }, (0,external_wp_element_namespaceObject.createElement)("h2", {
24084
- className: "block-editor-inserter__panel-title"
24085
- }, title), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
24086
- icon: icon
24087
- })), (0,external_wp_element_namespaceObject.createElement)("div", {
24088
- className: "block-editor-inserter__panel-content"
24089
- }, children));
 
 
 
 
 
 
 
24090
  }
 
 
 
24091
 
24092
- /* harmony default export */ var panel = (InserterPanel);
24093
- //# sourceMappingURL=panel.js.map
24094
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/hooks/use-block-types-state.js
24095
  /**
24096
  * WordPress dependencies
24097
  */
24098
 
24099
 
24100
 
 
24101
  /**
24102
  * Internal dependencies
24103
  */
24104
 
24105
 
24106
- /**
24107
- * Retrieves the block types inserter state.
24108
- *
24109
- * @param {string=} rootClientId Insertion's root client ID.
24110
- * @param {Function} onInsert function called when inserter a list of blocks.
24111
- * @return {Array} Returns the block types state. (block types, categories, collections, onSelect handler)
24112
- */
24113
 
24114
- const useBlockTypesState = (rootClientId, onInsert) => {
24115
- const {
24116
- categories,
24117
- collections,
24118
- items
24119
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
24120
- const {
24121
- getInserterItems
24122
- } = select(store);
 
 
 
 
 
24123
  const {
24124
- getCategories,
24125
- getCollections
24126
- } = select(external_wp_blocks_namespaceObject.store);
24127
- return {
24128
- categories: getCategories(),
24129
- collections: getCollections(),
24130
- items: getInserterItems(rootClientId)
24131
- };
24132
- }, [rootClientId]);
24133
- const onSelectItem = (0,external_wp_element_namespaceObject.useCallback)(({
24134
- name,
24135
- initialAttributes,
24136
- innerBlocks
24137
- }, shouldFocusBlock) => {
24138
- const insertedBlock = (0,external_wp_blocks_namespaceObject.createBlock)(name, initialAttributes, (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(innerBlocks));
24139
- onInsert(insertedBlock, undefined, shouldFocusBlock);
24140
- }, [onInsert]);
24141
- return [items, categories, collections, onSelectItem];
 
 
24142
  };
24143
 
24144
- /* harmony default export */ var use_block_types_state = (useBlockTypesState);
24145
- //# sourceMappingURL=use-block-types-state.js.map
24146
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter-listbox/index.js
24147
-
 
 
 
 
 
24148
 
24149
  /**
24150
  * WordPress dependencies
24151
  */
24152
 
 
24153
  /**
24154
- * Internal dependencies
 
 
 
 
 
24155
  */
24156
 
 
 
 
 
 
24157
 
 
 
 
 
24158
 
 
 
 
 
24159
 
 
 
 
 
 
 
 
 
 
 
 
24160
 
 
 
24161
 
24162
- function InserterListbox({
24163
- children
24164
- }) {
24165
- const compositeState = (0,external_wp_components_namespaceObject.__unstableUseCompositeState)({
24166
- shift: true,
24167
- wrap: 'horizontal'
24168
- });
24169
- return (0,external_wp_element_namespaceObject.createElement)(context.Provider, {
24170
- value: compositeState
24171
- }, children);
24172
- }
24173
 
24174
- /* harmony default export */ var inserter_listbox = (InserterListbox);
24175
- //# sourceMappingURL=index.js.map
24176
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/block-types-tab.js
 
 
24177
 
24178
 
24179
  /**
24180
  * External dependencies
24181
  */
24182
 
 
24183
  /**
24184
  * WordPress dependencies
24185
  */
@@ -24187,6 +24134,8 @@ function InserterListbox({
24187
 
24188
 
24189
 
 
 
24190
  /**
24191
  * Internal dependencies
24192
  */
@@ -24194,244 +24143,356 @@ function InserterListbox({
24194
 
24195
 
24196
 
 
24197
 
 
 
 
 
24198
 
24199
- const getBlockNamespace = item => item.name.split('/')[0];
 
 
 
 
 
24200
 
24201
- const MAX_SUGGESTED_ITEMS = 6;
24202
- /**
24203
- * Shared reference to an empty array for cases where it is important to avoid
24204
- * returning a new array reference on every invocation and rerendering the component.
24205
- *
24206
- * @type {Array}
24207
- */
24208
 
24209
- const block_types_tab_EMPTY_ARRAY = [];
24210
- function BlockTypesTab({
24211
- rootClientId,
24212
- onInsert,
24213
- onHover,
24214
- showMostUsedBlocks
24215
  }) {
24216
- const [items, categories, collections, onSelectItem] = use_block_types_state(rootClientId, onInsert);
24217
- const suggestedItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
24218
- return (0,external_lodash_namespaceObject.orderBy)(items, ['frecency'], ['desc']).slice(0, MAX_SUGGESTED_ITEMS);
24219
- }, [items]);
24220
- const uncategorizedItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
24221
- return items.filter(item => !item.category);
24222
- }, [items]);
24223
- const itemsPerCategory = (0,external_wp_element_namespaceObject.useMemo)(() => {
24224
- return (0,external_lodash_namespaceObject.flow)(itemList => itemList.filter(item => item.category && item.category !== 'reusable'), itemList => (0,external_lodash_namespaceObject.groupBy)(itemList, 'category'))(items);
24225
- }, [items]);
24226
- const itemsPerCollection = (0,external_wp_element_namespaceObject.useMemo)(() => {
24227
- // Create a new Object to avoid mutating collection.
24228
- const result = { ...collections
 
 
 
 
 
 
24229
  };
24230
- Object.keys(collections).forEach(namespace => {
24231
- result[namespace] = items.filter(item => getBlockNamespace(item) === namespace);
24232
 
24233
- if (result[namespace].length === 0) {
24234
- delete result[namespace];
24235
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24236
  });
24237
- return result;
24238
- }, [items, collections]); // Hide block preview on unmount.
24239
 
24240
- (0,external_wp_element_namespaceObject.useEffect)(() => () => onHover(null), []);
24241
- /**
24242
- * The inserter contains a big number of blocks and opening it is a costful operation.
24243
- * The rendering is the most costful part of it, in order to improve the responsiveness
24244
- * of the "opening" action, these lazy lists allow us to render the inserter category per category,
24245
- * once all the categories are rendered, we start rendering the collections and the uncategorized block types.
24246
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24247
 
24248
- const currentlyRenderedCategories = (0,external_wp_compose_namespaceObject.useAsyncList)(categories);
24249
- const didRenderAllCategories = categories.length === currentlyRenderedCategories.length; // Async List requires an array
 
24250
 
24251
- const collectionEntries = (0,external_wp_element_namespaceObject.useMemo)(() => {
24252
- return Object.entries(collections);
24253
- }, [collections]);
24254
- const currentlyRenderedCollections = (0,external_wp_compose_namespaceObject.useAsyncList)(didRenderAllCategories ? collectionEntries : block_types_tab_EMPTY_ARRAY);
24255
- return (0,external_wp_element_namespaceObject.createElement)(inserter_listbox, null, (0,external_wp_element_namespaceObject.createElement)("div", null, showMostUsedBlocks && !!suggestedItems.length && (0,external_wp_element_namespaceObject.createElement)(panel, {
24256
- title: (0,external_wp_i18n_namespaceObject._x)('Most used', 'blocks')
24257
- }, (0,external_wp_element_namespaceObject.createElement)(block_types_list, {
24258
- items: suggestedItems,
24259
- onSelect: onSelectItem,
24260
- onHover: onHover,
24261
- label: (0,external_wp_i18n_namespaceObject._x)('Most used', 'blocks')
24262
- })), (0,external_lodash_namespaceObject.map)(currentlyRenderedCategories, category => {
24263
- const categoryItems = itemsPerCategory[category.slug];
24264
 
24265
- if (!categoryItems || !categoryItems.length) {
24266
- return null;
24267
- }
24268
 
24269
- return (0,external_wp_element_namespaceObject.createElement)(panel, {
24270
- key: category.slug,
24271
- title: category.title,
24272
- icon: category.icon
24273
- }, (0,external_wp_element_namespaceObject.createElement)(block_types_list, {
24274
- items: categoryItems,
24275
- onSelect: onSelectItem,
24276
- onHover: onHover,
24277
- label: category.title
24278
- }));
24279
- }), didRenderAllCategories && uncategorizedItems.length > 0 && (0,external_wp_element_namespaceObject.createElement)(panel, {
24280
- className: "block-editor-inserter__uncategorized-blocks-panel",
24281
- title: (0,external_wp_i18n_namespaceObject.__)('Uncategorized')
24282
- }, (0,external_wp_element_namespaceObject.createElement)(block_types_list, {
24283
- items: uncategorizedItems,
24284
- onSelect: onSelectItem,
24285
- onHover: onHover,
24286
- label: (0,external_wp_i18n_namespaceObject.__)('Uncategorized')
24287
- })), (0,external_lodash_namespaceObject.map)(currentlyRenderedCollections, ([namespace, collection]) => {
24288
- const collectionItems = itemsPerCollection[namespace];
24289
 
24290
- if (!collectionItems || !collectionItems.length) {
24291
- return null;
24292
- }
24293
 
24294
- return (0,external_wp_element_namespaceObject.createElement)(panel, {
24295
- key: namespace,
24296
- title: collection.title,
24297
- icon: collection.icon
24298
- }, (0,external_wp_element_namespaceObject.createElement)(block_types_list, {
24299
- items: collectionItems,
24300
- onSelect: onSelectItem,
24301
- onHover: onHover,
24302
- label: collection.title
24303
- }));
24304
- })));
24305
- }
24306
- /* harmony default export */ var block_types_tab = (BlockTypesTab);
24307
- //# sourceMappingURL=block-types-tab.js.map
24308
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/pattern-panel.js
24309
 
24310
 
24311
  /**
24312
- * External dependencies
24313
  */
24314
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24315
  /**
24316
  * WordPress dependencies
24317
  */
24318
 
 
 
 
 
 
 
 
 
 
 
 
 
24319
 
 
 
 
 
 
 
24320
 
 
 
24321
 
24322
- function PatternInserterPanel({
24323
- selectedCategory,
24324
- patternCategories,
24325
- onClickCategory,
24326
- children
24327
- }) {
24328
- const categoryOptions = () => {
24329
- const options = [];
24330
- patternCategories.map(patternCategory => {
24331
- return options.push({
24332
- value: patternCategory.name,
24333
- label: patternCategory.label
24334
- });
24335
- });
24336
- return options;
24337
- };
24338
-
24339
- const onChangeSelect = selected => {
24340
- onClickCategory(patternCategories.find(patternCategory => selected === patternCategory.name));
24341
- };
24342
 
24343
- const getPanelHeaderClassName = () => {
24344
- return classnames_default()('block-editor-inserter__panel-header', 'block-editor-inserter__panel-header-patterns');
24345
- }; // In iOS-based mobile devices, the onBlur will fire when selecting an option
24346
- // from a Select element. To prevent closing the useDialog on iOS devices, we
24347
- // stop propagating the onBlur event if there is no relatedTarget, which means
24348
- // that the user most likely did not click on an element within the editor canvas.
 
 
 
 
 
 
 
24349
 
24350
 
24351
- const onBlur = event => {
24352
- if (!(event !== null && event !== void 0 && event.relatedTarget)) {
24353
- event.stopPropagation();
24354
- }
24355
- };
24356
 
24357
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
24358
- className: getPanelHeaderClassName()
24359
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
24360
- className: "block-editor-inserter__panel-dropdown",
24361
- label: (0,external_wp_i18n_namespaceObject.__)('Filter patterns'),
24362
- hideLabelFromVision: true,
24363
- value: selectedCategory.name,
24364
- onChange: onChangeSelect,
24365
- onBlur: onBlur,
24366
- options: categoryOptions()
24367
- })), (0,external_wp_element_namespaceObject.createElement)("div", {
24368
- className: "block-editor-inserter__panel-content"
24369
- }, children));
24370
- }
24371
 
24372
- /* harmony default export */ var pattern_panel = (PatternInserterPanel);
24373
- //# sourceMappingURL=pattern-panel.js.map
24374
- ;// CONCATENATED MODULE: external ["wp","notices"]
24375
- var external_wp_notices_namespaceObject = window["wp"]["notices"];
24376
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/hooks/use-patterns-state.js
24377
  /**
24378
- * External dependencies
 
 
 
 
 
 
24379
  */
24380
 
 
 
 
 
 
 
 
24381
  /**
24382
- * WordPress dependencies
 
 
 
 
 
 
24383
  */
24384
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24385
 
 
 
24386
 
24387
 
 
 
24388
 
 
 
 
 
 
24389
 
24390
  /**
24391
- * Internal dependencies
 
 
 
 
 
 
 
 
 
24392
  */
 
24393
 
 
 
 
24394
 
24395
- /**
24396
- * Retrieves the block patterns inserter state.
24397
- *
24398
- * @param {Function} onInsert function called when inserter a list of blocks.
24399
- * @param {string=} rootClientId Insertion's root client ID.
24400
- *
24401
- * @return {Array} Returns the patterns state. (patterns, categories, onSelect handler)
24402
- */
24403
 
24404
- const usePatternsState = (onInsert, rootClientId) => {
24405
- const {
24406
- patternCategories,
24407
- patterns
24408
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
24409
- const {
24410
- __experimentalGetAllowedPatterns,
24411
- getSettings
24412
- } = select(store);
24413
- return {
24414
- patterns: __experimentalGetAllowedPatterns(rootClientId),
24415
- patternCategories: getSettings().__experimentalBlockPatternCategories
24416
- };
24417
- }, [rootClientId]);
24418
- const {
24419
- createSuccessNotice
24420
- } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
24421
- const onClickPattern = (0,external_wp_element_namespaceObject.useCallback)((pattern, blocks) => {
24422
- onInsert((0,external_lodash_namespaceObject.map)(blocks, block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block)), pattern.name);
24423
- createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(
24424
- /* translators: %s: block pattern title. */
24425
- (0,external_wp_i18n_namespaceObject.__)('Block pattern "%s" inserted.'), pattern.title), {
24426
- type: 'snackbar'
24427
- });
24428
- }, []);
24429
- return [patterns, patternCategories, onClickPattern];
24430
  };
24431
 
24432
- /* harmony default export */ var use_patterns_state = (usePatternsState);
24433
- //# sourceMappingURL=use-patterns-state.js.map
24434
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-patterns-list/index.js
24435
 
24436
 
24437
 
@@ -24442,6 +24503,7 @@ const usePatternsState = (onInsert, rootClientId) => {
24442
 
24443
 
24444
 
 
24445
  /**
24446
  * Internal dependencies
24447
  */
@@ -24449,90 +24511,97 @@ const usePatternsState = (onInsert, rootClientId) => {
24449
 
24450
 
24451
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24452
 
24453
- function BlockPattern({
24454
- isDraggable,
24455
  pattern,
24456
- onClick,
24457
  composite
24458
  }) {
24459
- const {
24460
- name,
24461
- viewportWidth
24462
- } = pattern;
24463
- const {
24464
- blocks
24465
- } = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).__experimentalGetParsedPattern(name), [name]);
24466
- const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockPattern);
24467
- const descriptionId = `block-editor-block-patterns-list__item-description-${instanceId}`;
24468
- return (0,external_wp_element_namespaceObject.createElement)(inserter_draggable_blocks, {
24469
- isEnabled: isDraggable,
24470
- blocks: blocks
24471
- }, ({
24472
- draggable,
24473
- onDragStart,
24474
- onDragEnd
24475
- }) => (0,external_wp_element_namespaceObject.createElement)("div", {
24476
- className: "block-editor-block-patterns-list__list-item",
24477
  "aria-label": pattern.title,
24478
- "aria-describedby": pattern.description ? descriptionId : undefined,
24479
- draggable: draggable,
24480
- onDragStart: onDragStart,
24481
- onDragEnd: onDragEnd
24482
  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableCompositeItem, _extends({
24483
  role: "option",
24484
  as: "div"
24485
  }, composite, {
24486
- className: "block-editor-block-patterns-list__item",
24487
- onClick: () => onClick(pattern, blocks)
24488
  }), (0,external_wp_element_namespaceObject.createElement)(block_preview, {
24489
- blocks: blocks,
24490
- viewportWidth: viewportWidth
24491
  }), (0,external_wp_element_namespaceObject.createElement)("div", {
24492
- className: "block-editor-block-patterns-list__item-title"
24493
- }, pattern.title), !!pattern.description && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
24494
  id: descriptionId
24495
- }, pattern.description))));
24496
- }
24497
-
24498
- function BlockPatternPlaceholder() {
24499
- return (0,external_wp_element_namespaceObject.createElement)("div", {
24500
- className: "block-editor-block-patterns-list__item is-placeholder"
24501
- });
24502
- }
24503
-
24504
- function BlockPatternList({
24505
- isDraggable,
24506
- blockPatterns,
24507
- shownPatterns,
24508
- onClickPattern,
24509
- orientation,
24510
- label = (0,external_wp_i18n_namespaceObject.__)('Block Patterns')
24511
- }) {
24512
- const composite = (0,external_wp_components_namespaceObject.__unstableUseCompositeState)({
24513
- orientation
24514
- });
24515
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableComposite, _extends({}, composite, {
24516
- role: "listbox",
24517
- className: "block-editor-block-patterns-list",
24518
- "aria-label": label
24519
- }), blockPatterns.map(pattern => {
24520
- const isShown = shownPatterns.includes(pattern);
24521
- return isShown ? (0,external_wp_element_namespaceObject.createElement)(BlockPattern, {
24522
- key: pattern.name,
24523
- pattern: pattern,
24524
- onClick: onClickPattern,
24525
- isDraggable: isDraggable,
24526
- composite: composite
24527
- }) : (0,external_wp_element_namespaceObject.createElement)(BlockPatternPlaceholder, {
24528
- key: pattern.name
24529
- });
24530
- }));
24531
  }
24532
 
24533
- /* harmony default export */ var block_patterns_list = (BlockPatternList);
24534
- //# sourceMappingURL=index.js.map
24535
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/block-patterns-tab.js
24536
 
24537
 
24538
  /**
@@ -24546,474 +24615,392 @@ function BlockPatternList({
24546
 
24547
 
24548
 
24549
- /**
24550
- * Internal dependencies
24551
- */
24552
-
24553
-
24554
-
24555
-
24556
-
24557
- function BlockPatternsCategory({
24558
- rootClientId,
24559
- onInsert,
24560
- selectedCategory,
24561
- onClickCategory
24562
- }) {
24563
- const [allPatterns, allCategories, onClick] = use_patterns_state(onInsert, rootClientId); // Remove any empty categories
24564
-
24565
- const populatedCategories = (0,external_wp_element_namespaceObject.useMemo)(() => allCategories.filter(category => allPatterns.some(pattern => {
24566
- var _pattern$categories;
24567
-
24568
- return (_pattern$categories = pattern.categories) === null || _pattern$categories === void 0 ? void 0 : _pattern$categories.includes(category.name);
24569
- })), [allPatterns, allCategories]);
24570
- const patternCategory = selectedCategory ? selectedCategory : populatedCategories[0];
24571
- (0,external_wp_element_namespaceObject.useEffect)(() => {
24572
- if (allPatterns.some(pattern => getPatternIndex(pattern) === Infinity) && !populatedCategories.find(category => category.name === 'uncategorized')) {
24573
- populatedCategories.push({
24574
- name: 'uncategorized',
24575
- label: (0,external_wp_i18n_namespaceObject._x)('Uncategorized')
24576
- });
24577
- }
24578
- }, [populatedCategories, allPatterns]);
24579
- const getPatternIndex = (0,external_wp_element_namespaceObject.useCallback)(pattern => {
24580
- if (!pattern.categories || !pattern.categories.length) {
24581
- return Infinity;
24582
- }
24583
-
24584
- const indexedCategories = (0,external_lodash_namespaceObject.fromPairs)(populatedCategories.map(({
24585
- name
24586
- }, index) => [name, index]));
24587
- return Math.min(...pattern.categories.map(cat => indexedCategories[cat] !== undefined ? indexedCategories[cat] : Infinity));
24588
- }, [populatedCategories]);
24589
- const currentCategoryPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => allPatterns.filter(pattern => patternCategory.name === 'uncategorized' ? getPatternIndex(pattern) === Infinity : pattern.categories && pattern.categories.includes(patternCategory.name)), [allPatterns, patternCategory]); // Ordering the patterns is important for the async rendering.
24590
-
24591
- const orderedPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => {
24592
- return currentCategoryPatterns.sort((a, b) => {
24593
- return getPatternIndex(a) - getPatternIndex(b);
24594
- });
24595
- }, [currentCategoryPatterns, getPatternIndex]);
24596
- const currentShownPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(orderedPatterns);
24597
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, !!currentCategoryPatterns.length && (0,external_wp_element_namespaceObject.createElement)(pattern_panel, {
24598
- selectedCategory: patternCategory,
24599
- patternCategories: populatedCategories,
24600
- onClickCategory: onClickCategory
24601
- }, (0,external_wp_element_namespaceObject.createElement)(block_patterns_list, {
24602
- shownPatterns: currentShownPatterns,
24603
- blockPatterns: currentCategoryPatterns,
24604
- onClickPattern: onClick,
24605
- label: patternCategory.label,
24606
- orientation: "vertical",
24607
- isDraggable: true
24608
- })));
24609
- }
24610
-
24611
- function BlockPatternsTabs({
24612
- rootClientId,
24613
- onInsert,
24614
- onClickCategory,
24615
- selectedCategory
24616
- }) {
24617
- return (0,external_wp_element_namespaceObject.createElement)(BlockPatternsCategory, {
24618
- rootClientId: rootClientId,
24619
- selectedCategory: selectedCategory,
24620
- onInsert: onInsert,
24621
- onClickCategory: onClickCategory
24622
- });
24623
- }
24624
-
24625
- /* harmony default export */ var block_patterns_tab = (BlockPatternsTabs);
24626
- //# sourceMappingURL=block-patterns-tab.js.map
24627
- ;// CONCATENATED MODULE: external ["wp","url"]
24628
- var external_wp_url_namespaceObject = window["wp"]["url"];
24629
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/no-results.js
24630
 
24631
 
24632
  /**
24633
- * WordPress dependencies
24634
  */
24635
 
24636
 
24637
 
24638
- function InserterNoResults() {
24639
- return (0,external_wp_element_namespaceObject.createElement)("div", {
24640
- className: "block-editor-inserter__no-results"
24641
- }, (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
24642
- className: "block-editor-inserter__no-results-icon",
24643
- icon: block_default
24644
- }), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('No results found.')));
24645
- }
24646
-
24647
- /* harmony default export */ var no_results = (InserterNoResults);
24648
- //# sourceMappingURL=no-results.js.map
24649
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/reusable-blocks-tab.js
24650
-
24651
 
24652
- /**
24653
- * WordPress dependencies
24654
- */
24655
 
24656
 
24657
 
24658
- /**
24659
- * Internal dependencies
24660
- */
24661
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24662
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24663
 
 
24664
 
 
24665
 
 
24666
 
24667
- function ReusableBlocksList({
24668
- onHover,
24669
- onInsert,
24670
- rootClientId
24671
- }) {
24672
- const [items,,, onSelectItem] = use_block_types_state(rootClientId, onInsert);
24673
- const filteredItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
24674
- return items.filter(({
24675
- category
24676
- }) => category === 'reusable');
24677
- }, [items]);
24678
 
24679
- if (filteredItems.length === 0) {
24680
- return (0,external_wp_element_namespaceObject.createElement)(no_results, null);
24681
- }
 
24682
 
24683
- return (0,external_wp_element_namespaceObject.createElement)(panel, {
24684
- title: (0,external_wp_i18n_namespaceObject.__)('Reusable blocks')
24685
- }, (0,external_wp_element_namespaceObject.createElement)(block_types_list, {
24686
- items: filteredItems,
24687
- onSelect: onSelectItem,
24688
- onHover: onHover,
24689
- label: (0,external_wp_i18n_namespaceObject.__)('Reusable blocks')
24690
- }));
24691
- } // The unwrapped component is only exported for use by unit tests.
24692
 
24693
- /**
24694
- * List of reusable blocks shown in the "Reusable" tab of the inserter.
24695
- *
24696
- * @param {Object} props Component props.
24697
- * @param {?string} props.rootClientId Client id of block to insert into.
24698
- * @param {Function} props.onInsert Callback to run when item is inserted.
24699
- * @param {Function} props.onHover Callback to run when item is hovered.
24700
- *
24701
- * @return {WPComponent} The component.
24702
- */
 
24703
 
 
24704
 
24705
- function ReusableBlocksTab({
24706
- rootClientId,
24707
- onInsert,
24708
- onHover
24709
- }) {
24710
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(ReusableBlocksList, {
24711
- onHover: onHover,
24712
- onInsert: onInsert,
24713
- rootClientId: rootClientId
24714
- }), (0,external_wp_element_namespaceObject.createElement)("div", {
24715
- className: "block-editor-inserter__manage-reusable-blocks-container"
24716
- }, (0,external_wp_element_namespaceObject.createElement)("a", {
24717
- className: "block-editor-inserter__manage-reusable-blocks",
24718
- href: (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
24719
- post_type: 'wp_block'
24720
- })
24721
- }, (0,external_wp_i18n_namespaceObject.__)('Manage Reusable blocks'))));
24722
- }
24723
- /* harmony default export */ var reusable_blocks_tab = (ReusableBlocksTab);
24724
- //# sourceMappingURL=reusable-blocks-tab.js.map
24725
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter-menu-extension/index.js
24726
- /**
24727
- * WordPress dependencies
24728
- */
24729
 
24730
- const {
24731
- Fill: __unstableInserterMenuExtension,
24732
- Slot
24733
- } = (0,external_wp_components_namespaceObject.createSlotFill)('__unstableInserterMenuExtension');
24734
- __unstableInserterMenuExtension.Slot = Slot;
24735
- /* harmony default export */ var inserter_menu_extension = (__unstableInserterMenuExtension);
24736
- //# sourceMappingURL=index.js.map
24737
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/hooks/use-insertion-point.js
24738
- /**
24739
- * External dependencies
24740
- */
24741
 
24742
- /**
24743
- * WordPress dependencies
24744
- */
24745
 
 
 
 
 
 
 
 
 
 
 
 
24746
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24747
 
 
 
 
24748
 
 
 
 
 
 
 
 
 
24749
 
24750
 
24751
  /**
24752
- * Internal dependencies
24753
  */
24754
 
24755
-
 
 
 
 
 
 
 
 
 
 
24756
  /**
24757
- * @typedef WPInserterConfig
24758
- *
24759
- * @property {string=} rootClientId If set, insertion will be into the
24760
- * block with this ID.
24761
- * @property {number=} insertionIndex If set, insertion will be into this
24762
- * explicit position.
24763
- * @property {string=} clientId If set, insertion will be after the
24764
- * block with this ID.
24765
- * @property {boolean=} isAppender Whether the inserter is an appender
24766
- * or not.
24767
- * @property {Function=} onSelect Called after insertion.
24768
  */
24769
 
24770
- /**
24771
- * Returns the insertion point state given the inserter config.
24772
- *
24773
- * @param {WPInserterConfig} config Inserter Config.
24774
- * @return {Array} Insertion Point State (rootClientID, onInsertBlocks and onToggle).
24775
- */
24776
 
24777
- function useInsertionPoint({
24778
- rootClientId = '',
24779
- insertionIndex,
24780
- clientId,
24781
- isAppender,
24782
- onSelect,
24783
- shouldFocusBlock = true
24784
  }) {
24785
- const {
24786
- getSelectedBlock
24787
- } = (0,external_wp_data_namespaceObject.useSelect)(store);
24788
- const {
24789
- destinationRootClientId,
24790
- destinationIndex
24791
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
24792
- const {
24793
- getSelectedBlockClientId,
24794
- getBlockRootClientId,
24795
- getBlockIndex,
24796
- getBlockOrder
24797
- } = select(store);
24798
- const selectedBlockClientId = getSelectedBlockClientId();
24799
- let _destinationRootClientId = rootClientId;
24800
-
24801
- let _destinationIndex;
24802
 
24803
- if (insertionIndex !== undefined) {
24804
- // Insert into a specific index.
24805
- _destinationIndex = insertionIndex;
24806
- } else if (clientId) {
24807
- // Insert after a specific client ID.
24808
- _destinationIndex = getBlockIndex(clientId, _destinationRootClientId);
24809
- } else if (!isAppender && selectedBlockClientId) {
24810
- _destinationRootClientId = getBlockRootClientId(selectedBlockClientId);
24811
- _destinationIndex = getBlockIndex(selectedBlockClientId, _destinationRootClientId) + 1;
24812
- } else {
24813
- // Insert at the end of the list.
24814
- _destinationIndex = getBlockOrder(_destinationRootClientId).length;
24815
  }
 
24816
 
24817
- return {
24818
- destinationRootClientId: _destinationRootClientId,
24819
- destinationIndex: _destinationIndex
24820
- };
24821
- }, [rootClientId, insertionIndex, clientId, isAppender]);
24822
- const {
24823
- replaceBlocks,
24824
- insertBlocks,
24825
- showInsertionPoint,
24826
- hideInsertionPoint
24827
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
24828
- const onInsertBlocks = (0,external_wp_element_namespaceObject.useCallback)((blocks, meta, shouldForceFocusBlock = false) => {
24829
- const selectedBlock = getSelectedBlock();
24830
-
24831
- if (!isAppender && selectedBlock && (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(selectedBlock)) {
24832
- replaceBlocks(selectedBlock.clientId, blocks, null, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta);
24833
- } else {
24834
- insertBlocks(blocks, destinationIndex, destinationRootClientId, true, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta);
24835
- }
24836
 
24837
- const message = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: the name of the block that has been added
24838
- (0,external_wp_i18n_namespaceObject._n)('%d block added.', '%d blocks added.', (0,external_lodash_namespaceObject.castArray)(blocks).length), (0,external_lodash_namespaceObject.castArray)(blocks).length);
24839
- (0,external_wp_a11y_namespaceObject.speak)(message);
 
24840
 
24841
- if (onSelect) {
24842
- onSelect();
24843
- }
24844
- }, [isAppender, getSelectedBlock, replaceBlocks, insertBlocks, destinationRootClientId, destinationIndex, onSelect, shouldFocusBlock]);
24845
- const onToggleInsertionPoint = (0,external_wp_element_namespaceObject.useCallback)(show => {
24846
- if (show) {
24847
- showInsertionPoint(destinationRootClientId, destinationIndex);
24848
- } else {
24849
- hideInsertionPoint();
24850
- }
24851
- }, [showInsertionPoint, hideInsertionPoint, destinationRootClientId, destinationIndex]);
24852
- return [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint];
24853
  }
 
 
 
24854
 
24855
- /* harmony default export */ var use_insertion_point = (useInsertionPoint);
24856
- //# sourceMappingURL=use-insertion-point.js.map
24857
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/search-items.js
24858
  /**
24859
- * External dependencies
24860
  */
24861
- // Default search helpers
24862
 
24863
- const defaultGetName = item => item.name || '';
24864
 
24865
- const defaultGetTitle = item => item.title;
24866
 
24867
- const defaultGetDescription = item => item.description || '';
24868
 
24869
- const defaultGetKeywords = item => item.keywords || [];
24870
 
24871
- const defaultGetCategory = item => item.category;
24872
 
24873
- const defaultGetCollection = () => null;
24874
  /**
24875
- * Sanitizes the search input string.
24876
- *
24877
- * @param {string} input The search input to normalize.
24878
- *
24879
- * @return {string} The normalized search input.
24880
  */
24881
 
24882
 
24883
- function normalizeSearchInput(input = '') {
24884
- // Disregard diacritics.
24885
- // Input: "média"
24886
- input = (0,external_lodash_namespaceObject.deburr)(input); // Accommodate leading slash, matching autocomplete expectations.
24887
- // Input: "/media"
24888
-
24889
- input = input.replace(/^\//, ''); // Lowercase.
24890
- // Input: "MEDIA"
24891
 
24892
- input = input.toLowerCase();
24893
- return input;
24894
- }
24895
- /**
24896
- * Converts the search term into a list of normalized terms.
24897
- *
24898
- * @param {string} input The search term to normalize.
24899
- *
24900
- * @return {string[]} The normalized list of search terms.
24901
- */
 
 
24902
 
 
 
24903
 
24904
- const getNormalizedSearchTerms = (input = '') => {
24905
- // Extract words.
24906
- return (0,external_lodash_namespaceObject.words)(normalizeSearchInput(input));
24907
- };
 
 
 
 
 
 
24908
 
24909
- const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => {
24910
- return (0,external_lodash_namespaceObject.differenceWith)(unmatchedTerms, getNormalizedSearchTerms(unprocessedTerms), (unmatchedTerm, unprocessedTerm) => unprocessedTerm.includes(unmatchedTerm));
24911
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24912
 
24913
- const searchBlockItems = (items, categories, collections, searchInput) => {
24914
- const normalizedSearchTerms = getNormalizedSearchTerms(searchInput);
 
24915
 
24916
- if (normalizedSearchTerms.length === 0) {
24917
- return items;
24918
- }
24919
 
24920
- const config = {
24921
- getCategory: item => {
24922
- var _find;
 
 
 
 
 
24923
 
24924
- return (_find = (0,external_lodash_namespaceObject.find)(categories, {
24925
- slug: item.category
24926
- })) === null || _find === void 0 ? void 0 : _find.title;
24927
- },
24928
- getCollection: item => {
24929
- var _collections$item$nam;
24930
 
24931
- return (_collections$item$nam = collections[item.name.split('/')[0]]) === null || _collections$item$nam === void 0 ? void 0 : _collections$item$nam.title;
24932
- }
24933
- };
24934
- return searchItems(items, searchInput, config);
24935
- };
24936
- /**
24937
- * Filters an item list given a search term.
24938
- *
24939
- * @param {Array} items Item list
24940
- * @param {string} searchInput Search input.
24941
- * @param {Object} config Search Config.
24942
- *
24943
- * @return {Array} Filtered item list.
24944
- */
24945
 
24946
- const searchItems = (items = [], searchInput = '', config = {}) => {
24947
- const normalizedSearchTerms = getNormalizedSearchTerms(searchInput);
 
24948
 
24949
- if (normalizedSearchTerms.length === 0) {
24950
- return items;
24951
- }
24952
 
24953
- const rankedItems = items.map(item => {
24954
- return [item, getItemSearchRank(item, searchInput, config)];
24955
- }).filter(([, rank]) => rank > 0);
24956
- rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1);
24957
- return rankedItems.map(([item]) => item);
24958
- };
24959
- /**
24960
- * Get the search rank for a given item and a specific search term.
24961
- * The better the match, the higher the rank.
24962
- * If the rank equals 0, it should be excluded from the results.
24963
- *
24964
- * @param {Object} item Item to filter.
24965
- * @param {string} searchTerm Search term.
24966
- * @param {Object} config Search Config.
24967
- *
24968
- * @return {number} Search Rank.
24969
- */
24970
 
24971
- function getItemSearchRank(item, searchTerm, config = {}) {
24972
- const {
24973
- getName = defaultGetName,
24974
- getTitle = defaultGetTitle,
24975
- getDescription = defaultGetDescription,
24976
- getKeywords = defaultGetKeywords,
24977
- getCategory = defaultGetCategory,
24978
- getCollection = defaultGetCollection
24979
- } = config;
24980
- const name = getName(item);
24981
- const title = getTitle(item);
24982
- const description = getDescription(item);
24983
- const keywords = getKeywords(item);
24984
- const category = getCategory(item);
24985
- const collection = getCollection(item);
24986
- const normalizedSearchInput = normalizeSearchInput(searchTerm);
24987
- const normalizedTitle = normalizeSearchInput(title);
24988
- let rank = 0; // Prefers exact matches
24989
- // Then prefers if the beginning of the title matches the search term
24990
- // name, keywords, categories, collection, variations match come later.
24991
 
24992
- if (normalizedSearchInput === normalizedTitle) {
24993
- rank += 30;
24994
- } else if (normalizedTitle.startsWith(normalizedSearchInput)) {
24995
- rank += 20;
24996
- } else {
24997
- const terms = [name, title, description, ...keywords, category, collection].join(' ');
24998
- const normalizedSearchTerms = (0,external_lodash_namespaceObject.words)(normalizedSearchInput);
24999
- const unmatchedTerms = removeMatchingTerms(normalizedSearchTerms, terms);
25000
 
25001
- if (unmatchedTerms.length === 0) {
25002
- rank += 10;
 
 
 
 
 
 
 
 
 
 
 
 
 
25003
  }
25004
- } // Give a better rank to "core" namespaced items.
25005
-
25006
-
25007
- if (rank !== 0 && name.startsWith('core/')) {
25008
- rank++;
25009
- }
25010
 
25011
- return rank;
 
 
 
 
 
 
 
 
25012
  }
25013
- //# sourceMappingURL=search-items.js.map
25014
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/search-results.js
25015
 
 
 
 
 
 
 
 
25016
 
 
 
 
25017
  /**
25018
  * External dependencies
25019
  */
@@ -25024,127 +25011,129 @@ function getItemSearchRank(item, searchTerm, config = {}) {
25024
 
25025
 
25026
 
25027
-
25028
-
25029
-
25030
  /**
25031
  * Internal dependencies
25032
  */
25033
 
25034
 
25035
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25036
 
 
 
 
25037
 
 
 
 
 
 
25038
 
 
 
 
 
25039
 
 
25040
 
 
25041
 
 
 
 
25042
 
 
 
25043
 
25044
- const INITIAL_INSERTER_RESULTS = 9;
25045
- /**
25046
- * Shared reference to an empty array for cases where it is important to avoid
25047
- * returning a new array reference on every invocation and rerendering the component.
25048
- *
25049
- * @type {Array}
25050
- */
25051
 
25052
- const search_results_EMPTY_ARRAY = [];
25053
 
25054
- function InserterSearchResults({
25055
- filterValue,
25056
- onSelect,
25057
- onHover,
25058
- rootClientId,
25059
- clientId,
25060
- isAppender,
25061
- __experimentalInsertionIndex,
25062
- maxBlockPatterns,
25063
- maxBlockTypes,
25064
- showBlockDirectory = false,
25065
- isDraggable = true,
25066
- shouldFocusBlock = true
25067
- }) {
25068
- const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
25069
- const [destinationRootClientId, onInsertBlocks] = use_insertion_point({
25070
- onSelect,
25071
- rootClientId,
25072
- clientId,
25073
- isAppender,
25074
- insertionIndex: __experimentalInsertionIndex,
25075
- shouldFocusBlock
25076
- });
25077
- const [blockTypes, blockTypeCategories, blockTypeCollections, onSelectBlockType] = use_block_types_state(destinationRootClientId, onInsertBlocks);
25078
- const [patterns,, onSelectBlockPattern] = use_patterns_state(onInsertBlocks, destinationRootClientId);
25079
- const filteredBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => {
25080
- const results = searchBlockItems((0,external_lodash_namespaceObject.orderBy)(blockTypes, ['frecency'], ['desc']), blockTypeCategories, blockTypeCollections, filterValue);
25081
- return maxBlockTypes !== undefined ? results.slice(0, maxBlockTypes) : results;
25082
- }, [filterValue, blockTypes, blockTypeCategories, blockTypeCollections, maxBlockTypes]);
25083
- const filteredBlockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => {
25084
- const results = searchItems(patterns, filterValue);
25085
- return maxBlockPatterns !== undefined ? results.slice(0, maxBlockPatterns) : results;
25086
- }, [filterValue, patterns, maxBlockPatterns]); // Announce search results on change
25087
 
25088
- (0,external_wp_element_namespaceObject.useEffect)(() => {
25089
- if (!filterValue) {
25090
- return;
25091
- }
25092
 
25093
- const count = filteredBlockTypes.length + filteredBlockPatterns.length;
25094
- const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
25095
- /* translators: %d: number of results. */
25096
- (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count);
25097
- debouncedSpeak(resultsFoundMessage);
25098
- }, [filterValue, debouncedSpeak]);
25099
- const currentShownBlockTypes = (0,external_wp_compose_namespaceObject.useAsyncList)(filteredBlockTypes, {
25100
- step: INITIAL_INSERTER_RESULTS
25101
- });
25102
- const currentShownPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(currentShownBlockTypes.length === filteredBlockTypes.length ? filteredBlockPatterns : search_results_EMPTY_ARRAY);
25103
- const hasItems = !(0,external_lodash_namespaceObject.isEmpty)(filteredBlockTypes) || !(0,external_lodash_namespaceObject.isEmpty)(filteredBlockPatterns);
25104
- return (0,external_wp_element_namespaceObject.createElement)(inserter_listbox, null, !showBlockDirectory && !hasItems && (0,external_wp_element_namespaceObject.createElement)(no_results, null), !!filteredBlockTypes.length && (0,external_wp_element_namespaceObject.createElement)(panel, {
25105
- title: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null, (0,external_wp_i18n_namespaceObject.__)('Blocks'))
25106
- }, (0,external_wp_element_namespaceObject.createElement)(block_types_list, {
25107
- items: currentShownBlockTypes,
25108
- onSelect: onSelectBlockType,
25109
- onHover: onHover,
25110
- label: (0,external_wp_i18n_namespaceObject.__)('Blocks'),
25111
- isDraggable: isDraggable
25112
- })), !!filteredBlockTypes.length && !!filteredBlockPatterns.length && (0,external_wp_element_namespaceObject.createElement)("div", {
25113
- className: "block-editor-inserter__quick-inserter-separator"
25114
- }), !!filteredBlockPatterns.length && (0,external_wp_element_namespaceObject.createElement)(panel, {
25115
- title: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null, (0,external_wp_i18n_namespaceObject.__)('Block Patterns'))
25116
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
25117
- className: "block-editor-inserter__quick-inserter-patterns"
25118
- }, (0,external_wp_element_namespaceObject.createElement)(block_patterns_list, {
25119
- shownPatterns: currentShownPatterns,
25120
- blockPatterns: filteredBlockPatterns,
25121
- onClickPattern: onSelectBlockPattern,
25122
- isDraggable: isDraggable
25123
- }))), showBlockDirectory && (0,external_wp_element_namespaceObject.createElement)(inserter_menu_extension.Slot, {
25124
- fillProps: {
25125
- onSelect: onSelectBlockType,
25126
- onHover,
25127
- filterValue,
25128
- hasItems,
25129
- rootClientId: destinationRootClientId
25130
- }
25131
- }, fills => {
25132
- if (fills.length) {
25133
- return fills;
25134
- }
25135
 
25136
- if (!hasItems) {
25137
- return (0,external_wp_element_namespaceObject.createElement)(no_results, null);
 
 
 
25138
  }
25139
 
25140
- return null;
25141
- }));
25142
  }
 
 
25143
 
25144
- /* harmony default export */ var search_results = (InserterSearchResults);
25145
- //# sourceMappingURL=search-results.js.map
25146
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/tabs.js
25147
 
 
 
 
25148
 
25149
  /**
25150
  * WordPress dependencies
@@ -25152,54 +25141,57 @@ function InserterSearchResults({
25152
 
25153
 
25154
 
25155
- const blocksTab = {
25156
- name: 'blocks',
25157
-
25158
- /* translators: Blocks tab title in the block inserter. */
25159
- title: (0,external_wp_i18n_namespaceObject.__)('Blocks')
25160
- };
25161
- const patternsTab = {
25162
- name: 'patterns',
25163
 
25164
- /* translators: Patterns tab title in the block inserter. */
25165
- title: (0,external_wp_i18n_namespaceObject.__)('Patterns')
25166
- };
25167
- const reusableBlocksTab = {
25168
- name: 'reusable',
25169
 
25170
- /* translators: Reusable blocks tab title in the block inserter. */
25171
- title: (0,external_wp_i18n_namespaceObject.__)('Reusable')
25172
- };
25173
 
25174
- function InserterTabs({
25175
- children,
25176
- showPatterns = false,
25177
- showReusableBlocks = false,
25178
- onSelect
25179
- }) {
25180
- const tabs = (0,external_wp_element_namespaceObject.useMemo)(() => {
25181
- const tempTabs = [blocksTab];
25182
 
25183
- if (showPatterns) {
25184
- tempTabs.push(patternsTab);
25185
- }
25186
 
25187
- if (showReusableBlocks) {
25188
- tempTabs.push(reusableBlocksTab);
25189
- }
 
 
 
 
 
 
 
25190
 
25191
- return tempTabs;
25192
- }, [blocksTab, showPatterns, patternsTab, showReusableBlocks, reusableBlocksTab]);
25193
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TabPanel, {
25194
- className: "block-editor-inserter__tabs",
25195
- tabs: tabs,
25196
- onSelect: onSelect
25197
- }, children);
25198
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25199
 
25200
- /* harmony default export */ var tabs = (InserterTabs);
25201
- //# sourceMappingURL=tabs.js.map
25202
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/menu.js
25203
 
25204
 
25205
  /**
@@ -25207,6 +25199,27 @@ function InserterTabs({
25207
  */
25208
 
25209
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25210
 
25211
 
25212
  /**
@@ -25215,240 +25228,189 @@ function InserterTabs({
25215
 
25216
 
25217
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25218
 
25219
 
25220
 
25221
 
 
 
 
25222
 
25223
 
25224
 
25225
 
25226
- function InserterMenu({
25227
- rootClientId,
25228
- clientId,
25229
- isAppender,
25230
- __experimentalInsertionIndex,
25231
- onSelect,
25232
- showInserterHelpPanel,
25233
- showMostUsedBlocks,
25234
- __experimentalFilterValue = '',
25235
- shouldFocusBlock = true
25236
  }) {
25237
- const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(__experimentalFilterValue);
25238
- const [hoveredItem, setHoveredItem] = (0,external_wp_element_namespaceObject.useState)(null);
25239
- const [selectedPatternCategory, setSelectedPatternCategory] = (0,external_wp_element_namespaceObject.useState)(null);
25240
- const [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint] = use_insertion_point({
25241
- rootClientId,
25242
- clientId,
25243
- isAppender,
25244
- insertionIndex: __experimentalInsertionIndex,
25245
- shouldFocusBlock
25246
- });
25247
  const {
25248
- showPatterns,
25249
- hasReusableBlocks
25250
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
25251
- var _getSettings$__experi;
25252
 
25253
- const {
25254
- __experimentalGetAllowedPatterns,
25255
- getSettings
25256
- } = select(store);
25257
- return {
25258
- showPatterns: !!__experimentalGetAllowedPatterns(destinationRootClientId).length,
25259
- hasReusableBlocks: !!((_getSettings$__experi = getSettings().__experimentalReusableBlocks) !== null && _getSettings$__experi !== void 0 && _getSettings$__experi.length)
25260
- };
25261
- }, [destinationRootClientId]);
25262
- const onInsert = (0,external_wp_element_namespaceObject.useCallback)((blocks, meta, shouldForceFocusBlock) => {
25263
- onInsertBlocks(blocks, meta, shouldForceFocusBlock);
25264
- onSelect();
25265
- }, [onInsertBlocks, onSelect]);
25266
- const onInsertPattern = (0,external_wp_element_namespaceObject.useCallback)((blocks, patternName) => {
25267
- onInsertBlocks(blocks, {
25268
- patternName
25269
- });
25270
- onSelect();
25271
- }, [onInsertBlocks, onSelect]);
25272
- const onHover = (0,external_wp_element_namespaceObject.useCallback)(item => {
25273
- onToggleInsertionPoint(!!item);
25274
- setHoveredItem(item);
25275
- }, [onToggleInsertionPoint, setHoveredItem]);
25276
- const onClickPatternCategory = (0,external_wp_element_namespaceObject.useCallback)(patternCategory => {
25277
- setSelectedPatternCategory(patternCategory);
25278
- }, [setSelectedPatternCategory]);
25279
- const blocksTab = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
25280
- className: "block-editor-inserter__block-list"
25281
- }, (0,external_wp_element_namespaceObject.createElement)(block_types_tab, {
25282
- rootClientId: destinationRootClientId,
25283
- onInsert: onInsert,
25284
- onHover: onHover,
25285
- showMostUsedBlocks: showMostUsedBlocks
25286
- })), showInserterHelpPanel && (0,external_wp_element_namespaceObject.createElement)("div", {
25287
- className: "block-editor-inserter__tips"
25288
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
25289
- as: "h2"
25290
- }, (0,external_wp_i18n_namespaceObject.__)('A tip for using the block editor')), (0,external_wp_element_namespaceObject.createElement)(tips, null))), [destinationRootClientId, onInsert, onHover, filterValue, showMostUsedBlocks, showInserterHelpPanel]);
25291
- const patternsTab = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_wp_element_namespaceObject.createElement)(block_patterns_tab, {
25292
- rootClientId: destinationRootClientId,
25293
- onInsert: onInsertPattern,
25294
- onClickCategory: onClickPatternCategory,
25295
- selectedCategory: selectedPatternCategory
25296
- }), [destinationRootClientId, onInsertPattern, onClickPatternCategory, selectedPatternCategory]);
25297
- const reusableBlocksTab = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_wp_element_namespaceObject.createElement)(reusable_blocks_tab, {
25298
- rootClientId: destinationRootClientId,
25299
- onInsert: onInsert,
25300
- onHover: onHover
25301
- }), [destinationRootClientId, onInsert, onHover]);
25302
- const getCurrentTab = (0,external_wp_element_namespaceObject.useCallback)(tab => {
25303
- if (tab.name === 'blocks') {
25304
- return blocksTab;
25305
- } else if (tab.name === 'patterns') {
25306
- return patternsTab;
25307
  }
 
25308
 
25309
- return reusableBlocksTab;
25310
- }, [blocksTab, patternsTab, reusableBlocksTab]);
25311
- return (0,external_wp_element_namespaceObject.createElement)("div", {
25312
- className: "block-editor-inserter__menu"
25313
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
25314
- className: "block-editor-inserter__main-area"
25315
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
25316
- className: "block-editor-inserter__content"
25317
- }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SearchControl, {
25318
- className: "block-editor-inserter__search",
25319
- onChange: value => {
25320
- if (hoveredItem) setHoveredItem(null);
25321
- setFilterValue(value);
25322
- },
25323
- value: filterValue,
25324
- label: (0,external_wp_i18n_namespaceObject.__)('Search for blocks and patterns'),
25325
- placeholder: (0,external_wp_i18n_namespaceObject.__)('Search')
25326
- }), !!filterValue && (0,external_wp_element_namespaceObject.createElement)(search_results, {
25327
- filterValue: filterValue,
25328
- onSelect: onSelect,
25329
- onHover: onHover,
25330
- rootClientId: rootClientId,
25331
- clientId: clientId,
25332
- isAppender: isAppender,
25333
- __experimentalInsertionIndex: __experimentalInsertionIndex,
25334
- showBlockDirectory: true,
25335
- shouldFocusBlock: shouldFocusBlock
25336
- }), !filterValue && (showPatterns || hasReusableBlocks) && (0,external_wp_element_namespaceObject.createElement)(tabs, {
25337
- showPatterns: showPatterns,
25338
- showReusableBlocks: hasReusableBlocks
25339
- }, getCurrentTab), !filterValue && !showPatterns && !hasReusableBlocks && blocksTab)), showInserterHelpPanel && hoveredItem && (0,external_wp_element_namespaceObject.createElement)(preview_panel, {
25340
- item: hoveredItem
25341
- }));
25342
- }
25343
 
25344
- /* harmony default export */ var menu = (InserterMenu);
25345
- //# sourceMappingURL=menu.js.map
25346
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/quick-inserter.js
25347
 
 
 
25348
 
25349
- /**
25350
- * External dependencies
25351
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
25352
 
 
 
 
25353
  /**
25354
  * WordPress dependencies
25355
  */
25356
 
25357
 
25358
-
25359
-
25360
-
25361
  /**
25362
  * Internal dependencies
25363
  */
25364
 
25365
 
 
 
 
 
 
 
 
 
 
 
25366
 
 
 
 
 
 
 
 
25367
 
25368
-
25369
-
25370
- const SEARCH_THRESHOLD = 6;
25371
- const SHOWN_BLOCK_TYPES = 6;
25372
- const SHOWN_BLOCK_PATTERNS = 2;
25373
- function QuickInserter({
25374
- onSelect,
25375
- rootClientId,
25376
- clientId,
25377
- isAppender
25378
- }) {
25379
- const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)('');
25380
- const [destinationRootClientId, onInsertBlocks] = use_insertion_point({
25381
- onSelect,
25382
- rootClientId,
25383
- clientId,
25384
- isAppender
25385
- });
25386
- const [blockTypes] = use_block_types_state(destinationRootClientId, onInsertBlocks);
25387
- const [patterns] = use_patterns_state(onInsertBlocks, destinationRootClientId);
25388
- const showPatterns = patterns.length && !!filterValue;
25389
- const showSearch = showPatterns && patterns.length > SEARCH_THRESHOLD || blockTypes.length > SEARCH_THRESHOLD;
25390
  const {
25391
- setInserterIsOpened,
25392
- insertionIndex
 
 
 
25393
  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
 
 
25394
  const {
25395
- getSettings,
25396
- getBlockIndex,
25397
- getBlockCount
 
25398
  } = select(store);
25399
- const index = getBlockIndex(clientId, rootClientId);
25400
- return {
25401
- setInserterIsOpened: getSettings().__experimentalSetIsInserterOpened,
25402
- insertionIndex: index === -1 ? getBlockCount() : index
25403
- };
25404
- }, [clientId, rootClientId]);
25405
- (0,external_wp_element_namespaceObject.useEffect)(() => {
25406
- if (setInserterIsOpened) {
25407
- setInserterIsOpened(false);
25408
- }
25409
- }, [setInserterIsOpened]); // When clicking Browse All select the appropriate block so as
25410
- // the insertion point can work as expected
25411
 
25412
- const onBrowseAll = () => {
25413
- setInserterIsOpened({
25414
- rootClientId,
25415
- insertionIndex,
25416
- filterValue
25417
- });
25418
- };
25419
 
25420
- return (0,external_wp_element_namespaceObject.createElement)("div", {
25421
- className: classnames_default()('block-editor-inserter__quick-inserter', {
25422
- 'has-search': showSearch,
25423
- 'has-expand': setInserterIsOpened
25424
- })
25425
- }, showSearch && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SearchControl, {
25426
- className: "block-editor-inserter__search",
25427
- value: filterValue,
25428
- onChange: value => {
25429
- setFilterValue(value);
25430
- },
25431
- label: (0,external_wp_i18n_namespaceObject.__)('Search for blocks and patterns'),
25432
- placeholder: (0,external_wp_i18n_namespaceObject.__)('Search')
25433
- }), (0,external_wp_element_namespaceObject.createElement)("div", {
25434
- className: "block-editor-inserter__quick-inserter-results"
25435
- }, (0,external_wp_element_namespaceObject.createElement)(search_results, {
25436
- filterValue: filterValue,
25437
- onSelect: onSelect,
25438
- rootClientId: rootClientId,
25439
- clientId: clientId,
25440
- isAppender: isAppender,
25441
- maxBlockPatterns: showPatterns ? SHOWN_BLOCK_PATTERNS : 0,
25442
- maxBlockTypes: SHOWN_BLOCK_TYPES,
25443
- isDraggable: false
25444
- })), setInserterIsOpened && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
25445
- className: "block-editor-inserter__quick-inserter-expand",
25446
- onClick: onBrowseAll,
25447
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Browse all. This will open the main inserter panel in the editor toolbar.')
25448
- }, (0,external_wp_i18n_namespaceObject.__)('Browse all')));
 
 
 
 
25449
  }
25450
- //# sourceMappingURL=quick-inserter.js.map
25451
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/index.js
25452
 
25453
 
25454
 
@@ -25456,411 +25418,243 @@ function QuickInserter({
25456
  * External dependencies
25457
  */
25458
 
25459
-
25460
  /**
25461
  * WordPress dependencies
25462
  */
25463
 
25464
 
25465
 
25466
-
25467
-
25468
-
25469
-
25470
-
25471
-
25472
  /**
25473
  * Internal dependencies
25474
  */
25475
 
25476
 
25477
 
 
 
 
 
25478
 
25479
-
25480
- const defaultRenderToggle = ({
25481
- onToggle,
25482
- disabled,
25483
- isOpen,
25484
- blockTitle,
25485
- hasSingleBlockType,
25486
- toggleProps = {}
25487
  }) => {
25488
- let label;
25489
-
25490
- if (hasSingleBlockType) {
25491
- label = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name of the block when there is only one
25492
- (0,external_wp_i18n_namespaceObject._x)('Add %s', 'directly add the only allowed block'), blockTitle);
25493
- } else {
25494
- label = (0,external_wp_i18n_namespaceObject._x)('Add block', 'Generic label for block inserter button');
25495
- }
25496
-
25497
  const {
25498
- onClick,
25499
- ...rest
25500
- } = toggleProps; // Handle both onClick functions from the toggle and the parent component
 
 
 
 
 
 
 
 
 
 
 
25501
 
25502
- function handleClick(event) {
25503
- if (onToggle) {
25504
- onToggle(event);
 
 
 
 
 
 
 
25505
  }
25506
-
25507
- if (onClick) {
25508
- onClick(event);
 
 
25509
  }
25510
- }
25511
-
25512
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({
25513
- icon: library_plus,
25514
- label: label,
25515
- tooltipPosition: "bottom",
25516
- onClick: handleClick,
25517
- className: "block-editor-inserter__toggle",
25518
- "aria-haspopup": !hasSingleBlockType ? 'true' : false,
25519
- "aria-expanded": !hasSingleBlockType ? isOpen : false,
25520
- disabled: disabled
25521
- }, rest));
25522
  };
 
 
 
 
 
 
25523
 
25524
- class Inserter extends external_wp_element_namespaceObject.Component {
25525
- constructor() {
25526
- super(...arguments);
25527
- this.onToggle = this.onToggle.bind(this);
25528
- this.renderToggle = this.renderToggle.bind(this);
25529
- this.renderContent = this.renderContent.bind(this);
25530
- }
25531
-
25532
- onToggle(isOpen) {
25533
- const {
25534
- onToggle
25535
- } = this.props; // Surface toggle callback to parent component
25536
-
25537
- if (onToggle) {
25538
- onToggle(isOpen);
25539
- }
25540
- }
25541
- /**
25542
- * Render callback to display Dropdown toggle element.
25543
- *
25544
- * @param {Object} options
25545
- * @param {Function} options.onToggle Callback to invoke when toggle is
25546
- * pressed.
25547
- * @param {boolean} options.isOpen Whether dropdown is currently open.
25548
- *
25549
- * @return {WPElement} Dropdown toggle element.
25550
- */
25551
-
25552
-
25553
- renderToggle({
25554
- onToggle,
25555
- isOpen
25556
- }) {
25557
- const {
25558
- disabled,
25559
- blockTitle,
25560
- hasSingleBlockType,
25561
- directInsertBlock,
25562
- toggleProps,
25563
- hasItems,
25564
- renderToggle = defaultRenderToggle
25565
- } = this.props;
25566
- return renderToggle({
25567
- onToggle,
25568
- isOpen,
25569
- disabled: disabled || !hasItems,
25570
- blockTitle,
25571
- hasSingleBlockType,
25572
- directInsertBlock,
25573
- toggleProps
25574
- });
25575
- }
25576
- /**
25577
- * Render callback to display Dropdown content element.
25578
- *
25579
- * @param {Object} options
25580
- * @param {Function} options.onClose Callback to invoke when dropdown is
25581
- * closed.
25582
- *
25583
- * @return {WPElement} Dropdown content element.
25584
- */
25585
 
 
 
 
 
 
 
25586
 
25587
- renderContent({
25588
- onClose
25589
- }) {
25590
- const {
25591
- rootClientId,
25592
- clientId,
25593
- isAppender,
25594
- showInserterHelpPanel,
25595
- // This prop is experimental to give some time for the quick inserter to mature
25596
- // Feel free to make them stable after a few releases.
25597
- __experimentalIsQuick: isQuick
25598
- } = this.props;
25599
 
25600
- if (isQuick) {
25601
- return (0,external_wp_element_namespaceObject.createElement)(QuickInserter, {
25602
- onSelect: () => {
25603
- onClose();
25604
- },
25605
- rootClientId: rootClientId,
25606
- clientId: clientId,
25607
- isAppender: isAppender
25608
- });
25609
- }
25610
 
25611
- return (0,external_wp_element_namespaceObject.createElement)(menu, {
25612
- onSelect: () => {
25613
- onClose();
25614
- },
25615
- rootClientId: rootClientId,
25616
- clientId: clientId,
25617
- isAppender: isAppender,
25618
- showInserterHelpPanel: showInserterHelpPanel
25619
- });
25620
- }
25621
 
25622
- render() {
25623
- const {
25624
- position,
25625
- hasSingleBlockType,
25626
- directInsertBlock,
25627
- insertOnlyAllowedBlock,
25628
- __experimentalIsQuick: isQuick,
25629
- onSelectOrClose
25630
- } = this.props;
25631
 
25632
- if (hasSingleBlockType || directInsertBlock !== null && directInsertBlock !== void 0 && directInsertBlock.length) {
25633
- return this.renderToggle({
25634
- onToggle: insertOnlyAllowedBlock
25635
- });
25636
- }
25637
 
25638
- return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
25639
- className: "block-editor-inserter",
25640
- contentClassName: classnames_default()('block-editor-inserter__popover', {
25641
- 'is-quick': isQuick
25642
- }),
25643
- position: position,
25644
- onToggle: this.onToggle,
25645
- expandOnMobile: true,
25646
- headerTitle: (0,external_wp_i18n_namespaceObject.__)('Add a block'),
25647
- renderToggle: this.renderToggle,
25648
- renderContent: this.renderContent,
25649
- onClose: onSelectOrClose
25650
- });
25651
- }
25652
 
25653
- }
25654
 
25655
- /* harmony default export */ var inserter = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, {
25656
- clientId,
25657
- rootClientId
25658
- }) => {
25659
- const {
25660
- getBlockRootClientId,
25661
- hasInserterItems,
25662
- __experimentalGetAllowedBlocks,
25663
- __experimentalGetDirectInsertBlock
25664
- } = select(store);
25665
- const {
25666
- getBlockVariations
25667
- } = select(external_wp_blocks_namespaceObject.store);
25668
- rootClientId = rootClientId || getBlockRootClientId(clientId) || undefined;
25669
 
25670
- const allowedBlocks = __experimentalGetAllowedBlocks(rootClientId);
25671
 
25672
- const directInsertBlock = __experimentalGetDirectInsertBlock(rootClientId);
25673
 
25674
- const hasSingleBlockType = (0,external_lodash_namespaceObject.size)(allowedBlocks) === 1 && (0,external_lodash_namespaceObject.size)(getBlockVariations(allowedBlocks[0].name, 'inserter')) === 0;
25675
- let allowedBlockType = false;
25676
 
25677
- if (hasSingleBlockType) {
25678
- allowedBlockType = allowedBlocks[0];
25679
- }
25680
 
25681
- return {
25682
- hasItems: hasInserterItems(rootClientId),
25683
- hasSingleBlockType,
25684
- blockTitle: allowedBlockType ? allowedBlockType.title : '',
25685
- allowedBlockType,
25686
- directInsertBlock,
25687
- rootClientId
25688
- };
25689
- }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps, {
25690
- select
25691
- }) => {
25692
- return {
25693
- insertOnlyAllowedBlock() {
25694
- const {
25695
- rootClientId,
25696
- clientId,
25697
- isAppender,
25698
- hasSingleBlockType,
25699
- allowedBlockType,
25700
- directInsertBlock,
25701
- onSelectOrClose
25702
- } = ownProps;
25703
 
25704
- if (!hasSingleBlockType && !(directInsertBlock !== null && directInsertBlock !== void 0 && directInsertBlock.length)) {
25705
- return;
25706
- }
25707
 
25708
- function getInsertionIndex() {
25709
- const {
25710
- getBlockIndex,
25711
- getBlockSelectionEnd,
25712
- getBlockOrder,
25713
- getBlockRootClientId
25714
- } = select(store); // If the clientId is defined, we insert at the position of the block.
25715
 
25716
- if (clientId) {
25717
- return getBlockIndex(clientId, rootClientId);
25718
- } // If there a selected block, we insert after the selected block.
25719
 
25720
 
25721
- const end = getBlockSelectionEnd();
25722
 
25723
- if (!isAppender && end && getBlockRootClientId(end) === rootClientId) {
25724
- return getBlockIndex(end, rootClientId) + 1;
25725
- } // Otherwise, we insert at the end of the current rootClientId
25726
 
25727
 
25728
- return getBlockOrder(rootClientId).length;
25729
- }
 
 
 
25730
 
25731
- const {
25732
- insertBlock
25733
- } = dispatch(store);
25734
- const blockToInsert = directInsertBlock !== null && directInsertBlock !== void 0 && directInsertBlock.length ? (0,external_wp_blocks_namespaceObject.createBlock)(...directInsertBlock) : (0,external_wp_blocks_namespaceObject.createBlock)(allowedBlockType.name);
25735
- insertBlock(blockToInsert, getInsertionIndex(), rootClientId);
 
 
 
 
25736
 
25737
- if (onSelectOrClose) {
25738
- onSelectOrClose();
25739
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25740
 
25741
- const message = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name of the block that has been added
25742
- (0,external_wp_i18n_namespaceObject.__)('%s block added'), allowedBlockType.title);
25743
- (0,external_wp_a11y_namespaceObject.speak)(message);
25744
  }
25745
-
25746
- };
25747
- }), // The global inserter should always be visible, we are using ( ! isAppender && ! rootClientId && ! clientId ) as
25748
- // a way to detect the global Inserter.
25749
- (0,external_wp_compose_namespaceObject.ifCondition)(({
25750
- hasItems,
25751
- isAppender,
25752
- rootClientId,
25753
- clientId
25754
- }) => hasItems || !isAppender && !rootClientId && !clientId)])(Inserter));
25755
- //# sourceMappingURL=index.js.map
25756
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/default-block-appender/index.js
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25757
 
25758
 
25759
- /**
25760
- * External dependencies
25761
- */
25762
 
25763
  /**
25764
  * WordPress dependencies
25765
  */
25766
 
25767
-
25768
-
25769
-
25770
-
25771
-
25772
  /**
25773
  * Internal dependencies
25774
  */
25775
 
25776
 
25777
-
25778
- /**
25779
- * Zero width non-breaking space, used as padding for the paragraph when it is
25780
- * empty.
25781
- */
25782
-
25783
- const ZWNBSP = '\ufeff';
25784
- function DefaultBlockAppender({
25785
- isLocked,
25786
- isVisible,
25787
- onAppend,
25788
- showPrompt,
25789
- placeholder,
25790
- rootClientId
25791
- }) {
25792
- if (isLocked || !isVisible) {
25793
- return null;
25794
- }
25795
-
25796
- const value = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)('Type / to choose a block');
25797
-
25798
- return (0,external_wp_element_namespaceObject.createElement)("div", {
25799
- "data-root-client-id": rootClientId || '',
25800
- className: classnames_default()('block-editor-default-block-appender', {
25801
- 'has-visible-prompt': showPrompt
25802
- })
25803
- }, (0,external_wp_element_namespaceObject.createElement)("p", {
25804
- tabIndex: "0" // Only necessary for `useCanvasClickRedirect` to consider it
25805
- // as a target. Ideally it should consider any tabbable target,
25806
- // but the inserter is rendered in place while it should be
25807
- // rendered in a popover, just like it does for an empty
25808
- // paragraph block.
25809
- ,
25810
- contentEditable: true,
25811
- suppressContentEditableWarning: true // We want this element to be styled as a paragraph by themes.
25812
- // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
25813
- ,
25814
- role: "button",
25815
- "aria-label": (0,external_wp_i18n_namespaceObject.__)('Add block') // The wp-block className is important for editor styles.
25816
- ,
25817
- className: "wp-block block-editor-default-block-appender__content",
25818
- onFocus: onAppend
25819
- }, showPrompt ? value : ZWNBSP), (0,external_wp_element_namespaceObject.createElement)(inserter, {
25820
- rootClientId: rootClientId,
25821
- position: "bottom right",
25822
- isAppender: true,
25823
- __experimentalIsQuick: true
25824
- }));
25825
- }
25826
- /* harmony default export */ var default_block_appender = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => {
25827
- const {
25828
- getBlockCount,
25829
- getBlockName,
25830
- isBlockValid,
25831
- getSettings,
25832
- getTemplateLock
25833
- } = select(store);
25834
- const isEmpty = !getBlockCount(ownProps.rootClientId);
25835
- const isLastBlockDefault = getBlockName(ownProps.lastBlockClientId) === (0,external_wp_blocks_namespaceObject.getDefaultBlockName)();
25836
- const isLastBlockValid = isBlockValid(ownProps.lastBlockClientId);
25837
- const {
25838
- bodyPlaceholder
25839
- } = getSettings();
25840
- return {
25841
- isVisible: isEmpty || !isLastBlockDefault || !isLastBlockValid,
25842
- showPrompt: isEmpty,
25843
- isLocked: !!getTemplateLock(ownProps.rootClientId),
25844
- placeholder: bodyPlaceholder
25845
- };
25846
- }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps) => {
25847
- const {
25848
- insertDefaultBlock,
25849
- startTyping
25850
- } = dispatch(store);
25851
- return {
25852
- onAppend() {
25853
- const {
25854
- rootClientId
25855
- } = ownProps;
25856
- insertDefaultBlock(undefined, rootClientId);
25857
- startTyping();
25858
- }
25859
-
25860
- };
25861
- }))(DefaultBlockAppender));
25862
  //# sourceMappingURL=index.js.map
25863
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/button-block-appender/index.js
 
25864
 
25865
 
25866
  /**
@@ -25882,93 +25676,133 @@ function DefaultBlockAppender({
25882
 
25883
 
25884
 
25885
- function ButtonBlockAppender({
25886
- rootClientId,
25887
- className,
25888
- onFocus,
25889
- tabIndex
25890
- }, ref) {
25891
- return (0,external_wp_element_namespaceObject.createElement)(inserter, {
25892
- position: "bottom center",
25893
- rootClientId: rootClientId,
25894
- __experimentalIsQuick: true,
25895
- renderToggle: ({
25896
- onToggle,
25897
- disabled,
25898
- isOpen,
25899
- blockTitle,
25900
- hasSingleBlockType
25901
- }) => {
25902
- let label;
25903
 
25904
- if (hasSingleBlockType) {
25905
- label = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name of the block when there is only one
25906
- (0,external_wp_i18n_namespaceObject._x)('Add %s', 'directly add the only allowed block'), blockTitle);
25907
- } else {
25908
- label = (0,external_wp_i18n_namespaceObject._x)('Add block', 'Generic label for block inserter button');
25909
- }
25910
 
25911
- const isToggleButton = !hasSingleBlockType;
25912
- let inserterButton = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
25913
- ref: ref,
25914
- onFocus: onFocus,
25915
- tabIndex: tabIndex,
25916
- className: classnames_default()(className, 'block-editor-button-block-appender'),
25917
- onClick: onToggle,
25918
- "aria-haspopup": isToggleButton ? 'true' : undefined,
25919
- "aria-expanded": isToggleButton ? isOpen : undefined,
25920
- disabled: disabled,
25921
- label: label
25922
- }, !hasSingleBlockType && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
25923
- as: "span"
25924
- }, label), (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
25925
- icon: library_plus
25926
- }));
25927
 
25928
- if (isToggleButton || hasSingleBlockType) {
25929
- inserterButton = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Tooltip, {
25930
- text: label
25931
- }, inserterButton);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25932
  }
25933
 
25934
- return inserterButton;
25935
- },
25936
- isAppender: true
25937
- });
25938
- }
25939
- /**
25940
- * Use `ButtonBlockAppender` instead.
25941
- *
25942
- * @deprecated
25943
- */
25944
 
 
 
25945
 
25946
- const ButtonBlockerAppender = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
25947
- external_wp_deprecated_default()(`wp.blockEditor.ButtonBlockerAppender`, {
25948
- alternative: 'wp.blockEditor.ButtonBlockAppender'
25949
- });
25950
- return ButtonBlockAppender(props, ref);
25951
- });
25952
- /**
25953
- * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/button-block-appender/README.md
25954
- */
25955
 
25956
- /* harmony default export */ var button_block_appender = ((0,external_wp_element_namespaceObject.forwardRef)(ButtonBlockAppender));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25957
  //# sourceMappingURL=index.js.map
25958
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list-appender/index.js
 
25959
 
25960
 
25961
  /**
25962
  * External dependencies
25963
  */
25964
 
25965
-
25966
  /**
25967
  * WordPress dependencies
25968
  */
25969
 
25970
 
25971
 
 
25972
  /**
25973
  * Internal dependencies
25974
  */
@@ -25977,128 +25811,69 @@ const ButtonBlockerAppender = (0,external_wp_element_namespaceObject.forwardRef)
25977
 
25978
 
25979
 
25980
- function BlockListAppender({
25981
- blockClientIds,
25982
- rootClientId,
25983
- canInsertDefaultBlock,
25984
- isLocked,
25985
- renderAppender: CustomAppender,
25986
- className,
25987
- selectedBlockClientId,
25988
- tagName: TagName = 'div'
25989
  }) {
25990
- if (isLocked || CustomAppender === false) {
25991
- return null;
25992
- }
25993
-
25994
- let appender;
25995
-
25996
- if (CustomAppender) {
25997
- // Prefer custom render prop if provided.
25998
- appender = (0,external_wp_element_namespaceObject.createElement)(CustomAppender, null);
25999
- } else {
26000
- const isDocumentAppender = !rootClientId;
26001
- const isParentSelected = selectedBlockClientId === rootClientId;
26002
- const isAnotherDefaultAppenderAlreadyDisplayed = selectedBlockClientId && !blockClientIds.includes(selectedBlockClientId);
 
 
 
 
 
 
 
 
 
 
 
 
26003
 
26004
- if (!isDocumentAppender && !isParentSelected && (!selectedBlockClientId || isAnotherDefaultAppenderAlreadyDisplayed)) {
 
26005
  return null;
26006
  }
 
26007
 
26008
- if (canInsertDefaultBlock) {
26009
- // Render the default block appender when renderAppender has not been
26010
- // provided and the context supports use of the default appender.
26011
- appender = (0,external_wp_element_namespaceObject.createElement)(default_block_appender, {
26012
- rootClientId: rootClientId,
26013
- lastBlockClientId: (0,external_lodash_namespaceObject.last)(blockClientIds)
26014
- });
26015
- } else {
26016
- // Fallback in the case no renderAppender has been provided and the
26017
- // default block can't be inserted.
26018
- appender = (0,external_wp_element_namespaceObject.createElement)(button_block_appender, {
26019
- rootClientId: rootClientId,
26020
- className: "block-list-appender__toggle"
26021
- });
26022
- }
26023
- }
26024
 
26025
- return (0,external_wp_element_namespaceObject.createElement)(TagName // A `tabIndex` is used on the wrapping `div` element in order to
26026
- // force a focus event to occur when an appender `button` element
26027
- // is clicked. In some browsers (Firefox, Safari), button clicks do
26028
- // not emit a focus event, which could cause this event to propagate
26029
- // unexpectedly. The `tabIndex` ensures that the interaction is
26030
- // captured as a focus, without also adding an extra tab stop.
26031
- //
26032
- // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus
26033
- , {
26034
- tabIndex: -1,
26035
- className: classnames_default()('block-list-appender wp-block', className)
26036
- }, appender);
 
26037
  }
26038
 
26039
- /* harmony default export */ var block_list_appender = ((0,external_wp_data_namespaceObject.withSelect)((select, {
26040
- rootClientId
26041
- }) => {
26042
- const {
26043
- getBlockOrder,
26044
- canInsertBlockType,
26045
- getTemplateLock,
26046
- getSelectedBlockClientId
26047
- } = select(store);
26048
- return {
26049
- isLocked: !!getTemplateLock(rootClientId),
26050
- blockClientIds: getBlockOrder(rootClientId),
26051
- canInsertDefaultBlock: canInsertBlockType((0,external_wp_blocks_namespaceObject.getDefaultBlockName)(), rootClientId),
26052
- selectedBlockClientId: getSelectedBlockClientId()
26053
- };
26054
- })(BlockListAppender));
26055
- //# sourceMappingURL=index.js.map
26056
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-tools/use-popover-scroll.js
26057
- /**
26058
- * WordPress dependencies
26059
- */
26060
-
26061
- /**
26062
- * Allow scrolling "through" popovers over the canvas. This is only called for
26063
- * as long as the pointer is over a popover. Do not use React events because it
26064
- * will bubble through portals.
26065
- *
26066
- * @param {Object} scrollableRef
26067
- */
26068
-
26069
- function usePopoverScroll(scrollableRef) {
26070
- return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
26071
- if (!scrollableRef) {
26072
- return;
26073
- }
26074
-
26075
- function onWheel(event) {
26076
- const {
26077
- deltaX,
26078
- deltaY
26079
- } = event;
26080
- scrollableRef.current.scrollBy(deltaX, deltaY);
26081
- } // Tell the browser that we do not call event.preventDefault
26082
- // See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners
26083
-
26084
-
26085
- const options = {
26086
- passive: true
26087
- };
26088
- node.addEventListener('wheel', onWheel, options);
26089
- return () => {
26090
- node.removeEventListener('wheel', onWheel, options);
26091
- };
26092
- }, [scrollableRef]);
26093
- }
26094
- //# sourceMappingURL=use-popover-scroll.js.map
26095
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-tools/insertion-point.js
26096
 
26097
 
26098
  /**
26099
  * External dependencies
26100
  */
26101
 
 
26102
  /**
26103
  * WordPress dependencies
26104
  */
@@ -26107,6 +25882,9 @@ function usePopoverScroll(scrollableRef) {
26107
 
26108
 
26109
 
 
 
 
26110
  /**
26111
  * Internal dependencies
26112
  */
@@ -26115,220 +25893,287 @@ function usePopoverScroll(scrollableRef) {
26115
 
26116
 
26117
 
26118
- const InsertionPointOpenRef = (0,external_wp_element_namespaceObject.createContext)();
26119
 
26120
- function InsertionPointPopover({
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26121
  __unstablePopoverSlot,
26122
  __unstableContentRef
26123
  }) {
26124
  const {
26125
- selectBlock
26126
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
26127
- const openRef = (0,external_wp_element_namespaceObject.useContext)(InsertionPointOpenRef);
26128
- const ref = (0,external_wp_element_namespaceObject.useRef)();
26129
- const {
26130
- orientation,
26131
- previousClientId,
26132
- nextClientId,
26133
- rootClientId,
26134
- isInserterShown
26135
- } = (0,external_wp_data_namespaceObject.useSelect)(select => {
26136
- var _getBlockListSettings;
26137
-
26138
  const {
26139
- getBlockOrder,
26140
- getBlockListSettings,
26141
  getBlockInsertionPoint,
26142
- isBlockBeingDragged,
26143
- getPreviousBlockClientId,
26144
- getNextBlockClientId
26145
  } = select(store);
26146
- const insertionPoint = getBlockInsertionPoint();
26147
- const order = getBlockOrder(insertionPoint.rootClientId);
26148
-
26149
- if (!order.length) {
26150
- return {};
26151
- }
26152
-
26153
- let _previousClientId = order[insertionPoint.index - 1];
26154
- let _nextClientId = order[insertionPoint.index];
26155
-
26156
- while (isBlockBeingDragged(_previousClientId)) {
26157
- _previousClientId = getPreviousBlockClientId(_previousClientId);
26158
- }
26159
-
26160
- while (isBlockBeingDragged(_nextClientId)) {
26161
- _nextClientId = getNextBlockClientId(_nextClientId);
26162
- }
26163
-
26164
- return {
26165
- previousClientId: _previousClientId,
26166
- nextClientId: _nextClientId,
26167
- orientation: ((_getBlockListSettings = getBlockListSettings(insertionPoint.rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation) || 'vertical',
26168
- rootClientId: insertionPoint.rootClientId,
26169
- isInserterShown: insertionPoint === null || insertionPoint === void 0 ? void 0 : insertionPoint.__unstableWithInserter
26170
- };
26171
- }, []);
26172
- const previousElement = useBlockElement(previousClientId);
26173
- const nextElement = useBlockElement(nextClientId);
26174
- const style = (0,external_wp_element_namespaceObject.useMemo)(() => {
26175
- if (!previousElement && !nextElement) {
26176
- return {};
26177
- }
26178
-
26179
- const previousRect = previousElement ? previousElement.getBoundingClientRect() : null;
26180
- const nextRect = nextElement ? nextElement.getBoundingClientRect() : null;
26181
-
26182
- if (orientation === 'vertical') {
26183
- return {
26184
- width: previousElement ? previousElement.offsetWidth : nextElement.offsetWidth,
26185
- height: nextRect && previousRect ? nextRect.top - previousRect.bottom : 0
26186
- };
26187
- }
26188
-
26189
- let width = 0;
26190
-
26191
- if (previousRect && nextRect) {
26192
- width = (0,external_wp_i18n_namespaceObject.isRTL)() ? previousRect.left - nextRect.right : nextRect.left - previousRect.right;
26193
- }
26194
 
26195
- return {
26196
- width,
26197
- height: previousElement ? previousElement.offsetHeight : nextElement.offsetHeight
26198
- };
26199
- }, [previousElement, nextElement]);
26200
- const getAnchorRect = (0,external_wp_element_namespaceObject.useCallback)(() => {
26201
- if (!previousElement && !nextElement) {
26202
- return {};
26203
  }
26204
 
26205
- const {
26206
- ownerDocument
26207
- } = previousElement || nextElement;
26208
- const previousRect = previousElement ? previousElement.getBoundingClientRect() : null;
26209
- const nextRect = nextElement ? nextElement.getBoundingClientRect() : null;
26210
-
26211
- if (orientation === 'vertical') {
26212
- if ((0,external_wp_i18n_namespaceObject.isRTL)()) {
26213
- return {
26214
- top: previousRect ? previousRect.bottom : nextRect.top,
26215
- left: previousRect ? previousRect.right : nextRect.right,
26216
- right: previousRect ? previousRect.left : nextRect.left,
26217
- bottom: nextRect ? nextRect.top : previousRect.bottom,
26218
- ownerDocument
26219
- };
26220
- }
26221
-
26222
- return {
26223
- top: previousRect ? previousRect.bottom : nextRect.top,
26224
- left: previousRect ? previousRect.left : nextRect.left,
26225
- right: previousRect ? previousRect.right : nextRect.right,
26226
- bottom: nextRect ? nextRect.top : previousRect.bottom,
26227
- ownerDocument
26228
- };
26229
- }
26230
 
26231
- if ((0,external_wp_i18n_namespaceObject.isRTL)()) {
26232
- return {
26233
- top: previousRect ? previousRect.top : nextRect.top,
26234
- left: previousRect ? previousRect.left : nextRect.right,
26235
- right: nextRect ? nextRect.right : previousRect.left,
26236
- bottom: previousRect ? previousRect.bottom : nextRect.bottom,
26237
- ownerDocument
26238
- };
 
 
 
 
 
26239
  }
 
 
26240
 
26241
- return {
26242
- top: previousRect ? previousRect.top : nextRect.top,
26243
- left: previousRect ? previousRect.right : nextRect.left,
26244
- right: nextRect ? nextRect.left : previousRect.right,
26245
- bottom: previousRect ? previousRect.bottom : nextRect.bottom,
26246
- ownerDocument
26247
- };
26248
- }, [previousElement, nextElement]);
26249
  const popoverScrollRef = usePopoverScroll(__unstableContentRef);
26250
- const className = classnames_default()('block-editor-block-list__insertion-point', 'is-' + orientation);
26251
 
26252
- function onClick(event) {
26253
- if (event.target === ref.current && nextClientId) {
26254
- selectBlock(nextClientId, -1);
26255
- }
26256
  }
26257
 
26258
- function onFocus(event) {
26259
- // Only handle click on the wrapper specifically, and not an event
26260
- // bubbled from the inserter itself.
26261
- if (event.target !== ref.current) {
26262
- openRef.current = true;
 
 
 
 
 
 
 
 
 
 
 
 
26263
  }
26264
- } // Only show the in-between inserter between blocks, so when there's a
26265
- // previous and a next element.
26266
 
 
 
 
 
 
26267
 
26268
- const showInsertionPointInserter = previousElement && nextElement && isInserterShown;
26269
- /* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
26270
- // While ideally it would be enough to capture the
26271
- // bubbling focus event from the Inserter, due to the
26272
- // characteristics of click focusing of `button`s in
26273
- // Firefox and Safari, it is not reliable.
26274
- //
26275
- // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus
 
 
26276
 
 
 
 
 
 
 
 
 
 
 
26277
  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
26278
  ref: popoverScrollRef,
26279
  noArrow: true,
26280
  animate: false,
26281
- getAnchorRect: getAnchorRect,
26282
  focusOnMount: false,
26283
- className: "block-editor-block-list__insertion-point-popover" // Render in the old slot if needed for backward compatibility,
 
 
 
 
26284
  // otherwise render in place (not in the the default popover slot).
26285
  ,
26286
- __unstableSlotName: __unstablePopoverSlot || null
26287
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
26288
- ref: ref,
26289
- tabIndex: -1,
26290
- onClick: onClick,
 
 
 
 
26291
  onFocus: onFocus,
26292
- className: classnames_default()(className, {
26293
- 'is-with-inserter': showInsertionPointInserter
26294
- }),
26295
- style: style
26296
- }, (0,external_wp_element_namespaceObject.createElement)("div", {
26297
- className: "block-editor-block-list__insertion-point-indicator"
26298
- }), showInsertionPointInserter && (0,external_wp_element_namespaceObject.createElement)("div", {
26299
- className: classnames_default()('block-editor-block-list__insertion-point-inserter')
 
 
 
26300
  }, (0,external_wp_element_namespaceObject.createElement)(inserter, {
26301
- position: "bottom center",
26302
- clientId: nextClientId,
26303
  rootClientId: rootClientId,
26304
- __experimentalIsQuick: true,
26305
- onToggle: isOpen => {
26306
- openRef.current = isOpen;
26307
- },
26308
- onSelectOrClose: () => {
26309
- openRef.current = false;
26310
- }
26311
- }))));
26312
- /* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26313
  }
26314
 
26315
- function InsertionPoint({
26316
- children,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26317
  __unstablePopoverSlot,
26318
  __unstableContentRef
26319
  }) {
26320
- const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => {
26321
- return select(store).isBlockInsertionPointVisible();
26322
- }, []);
26323
- return (0,external_wp_element_namespaceObject.createElement)(InsertionPointOpenRef.Provider, {
26324
- value: (0,external_wp_element_namespaceObject.useRef)(false)
26325
- }, isVisible && (0,external_wp_element_namespaceObject.createElement)(InsertionPointPopover, {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26326
  __unstablePopoverSlot: __unstablePopoverSlot,
26327
  __unstableContentRef: __unstableContentRef
26328
- }), children);
26329
  }
26330
- //# sourceMappingURL=insertion-point.js.map
26331
- ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-in-between-inserter.js
 
 
26332
  /**
26333
  * WordPress dependencies
26334
  */
@@ -26341,539 +26186,724 @@ function InsertionPoint({
26341
 
26342
 
26343
 
26344
- function useInBetweenInserter() {
 
 
26345
  const openRef = (0,external_wp_element_namespaceObject.useContext)(InsertionPointOpenRef);
26346
- const hasReducedUI = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().hasReducedUI, []);
26347
- const {
26348
- getBlockListSettings,
26349
- getBlockRootClientId,
26350
- getBlockIndex,
26351
- isBlockInsertionPointVisible,
26352
- isMultiSelecting,
26353
- getSelectedBlockClientIds,
26354
- getTemplateLock
26355
- } = (0,external_wp_data_namespaceObject.useSelect)(store);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26356
  const {
26357
- showInsertionPoint,
26358
- hideInsertionPoint
26359
- } = (0,external_wp_data_namespaceObject.useDispatch)(store);
26360
- return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
26361
- if (hasReducedUI) {
26362
- return;
26363
- }
 
 
26364
 
26365
- function onMouseMove(event) {
26366
- var _getBlockListSettings, _element$parentElemen;
26367
 
26368
- if (openRef.current) {
26369
- return;
26370
- }
26371
 
26372
- if (isMultiSelecting()) {
26373
- return;
26374
- }
26375
 
26376
- if (!event.target.classList.contains('block-editor-block-list__layout')) {
26377
- if (isBlockInsertionPointVisible()) {
26378
- hideInsertionPoint();
26379
- }
26380
 
26381
- return;
26382
- }
26383
 
26384
- let rootClientId;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26385
 
26386
- if (!event.target.classList.contains('is-root-container')) {
26387
- const blockElement = !!event.target.getAttribute('data-block') ? event.target : event.target.closest('[data-block]');
26388
- rootClientId = blockElement.getAttribute('data-block');
26389
- } // Don't set the insertion point if the template is locked.
26390
 
 
 
 
26391
 
26392
- if (getTemplateLock(rootClientId)) {
26393
- return;
26394
- }
26395
 
26396
- const orientation = ((_getBlockListSettings = getBlockListSettings(rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation) || 'vertical';
26397
- const rect = event.target.getBoundingClientRect();
26398
- const offsetTop = event.clientY - rect.top;
26399
- const offsetLeft = event.clientX - rect.left;
26400
- const children = Array.from(event.target.children);
26401
- let element = children.find(blockEl => {
26402
- return blockEl.classList.contains('wp-block') && orientation === 'vertical' && blockEl.offsetTop > offsetTop || blockEl.classList.contains('wp-block') && orientation === 'horizontal' && blockEl.offsetLeft > offsetLeft;
26403
- });
26404
 
26405
- if (!element) {
26406
- return;
26407
- } // The block may be in an alignment wrapper, so check the first direct
26408
- // child if the element has no ID.
26409
 
 
 
 
26410
 
26411
- if (!element.id) {
26412
- element = element.firstElementChild;
26413
 
26414
- if (!element) {
26415
- return;
26416
- }
26417
- } // Don't show the insertion point if a parent block has an "overlay"
26418
- // See https://github.com/WordPress/gutenberg/pull/34012#pullrequestreview-727762337
26419
 
26420
 
26421
- const parentOverlay = (_element$parentElemen = element.parentElement) === null || _element$parentElemen === void 0 ? void 0 : _element$parentElemen.closest('.block-editor-block-content-overlay.overlay-active');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26422
 
26423
- if (parentOverlay) {
26424
- return;
26425
- }
26426
 
26427
- const clientId = element.id.slice('block-'.length);
26428
 
26429
- if (!clientId) {
26430
- return;
26431
- } // Don't show the inserter when hovering above (conflicts with
26432
- // block toolbar) or inside selected block(s).
26433
 
26434
 
26435
- if (getSelectedBlockClientIds().includes(clientId)) {
26436
- return;
26437
- }
26438
 
26439
- const elementRect = element.getBoundingClientRect();
 
 
 
 
 
 
 
 
 
 
 
2235
  "__experimentalLinkControlSearchItem": function() { return /* reexport */ search_item; },
2236
  "__experimentalLinkControlSearchResults": function() { return /* reexport */ LinkControlSearchResults; },
2237
  "__experimentalListView": function() { return /* reexport */ components_list_view; },
 
 
2238
  "__experimentalPanelColorGradientSettings": function() { return /* reexport */ panel_color_gradient_settings; },
2239
  "__experimentalPreviewOptions": function() { return /* reexport */ PreviewOptions; },
2240
  "__experimentalResponsiveBlockControl": function() { return /* reexport */ responsive_block_control; },
3063
  const subTree = buildBlockTree(newState, action.blocks);
3064
  newState.tree = updateParentInnerBlocksInTree(newState, { ...(0,external_lodash_namespaceObject.omit)(newState.tree, action.replacedClientIds.concat(action.replacedClientIds.map(clientId => 'controlled||' + clientId))),
3065
  ...subTree
3066
+ }, action.blocks.map(b => b.clientId)); // If there are no replaced blocks, it means we're removing blocks so we need to update their parent.
3067
+
3068
+ const parentsOfRemovedBlocks = [];
3069
+
3070
+ for (const clientId of action.clientIds) {
3071
+ if (state.parents[clientId] !== undefined && (state.parents[clientId] === '' || newState.byClientId[state.parents[clientId]])) {
3072
+ parentsOfRemovedBlocks.push(state.parents[clientId]);
3073
+ }
3074
+ }
3075
+
3076
+ newState.tree = updateParentInnerBlocksInTree(newState, newState.tree, parentsOfRemovedBlocks);
3077
  break;
3078
  }
3079
 
6135
  frecency: calculateFrecency(time, count)
6136
  };
6137
  if (buildScope === 'transform') return blockItemBase;
6138
+ const inserterVariations = (0,external_wp_blocks_namespaceObject.getBlockVariations)(blockType.name, 'inserter');
 
 
6139
  return { ...blockItemBase,
6140
  initialAttributes: {},
6141
  description: blockType.description,
8894
 
8895
  if (hasBlockGapStylesSupport) {
8896
  style += `
8897
+ ${appendSelectors(selector, '> *')} {
8898
+ margin-top: 0;
8899
+ margin-bottom: 0;
8900
+ }
8901
  ${appendSelectors(selector, '> * + *')} {
8902
  margin-top: var( --wp--style--block-gap );
 
8903
  }
8904
  `;
8905
  }
9082
  function useAvailableAlignments(controls = DEFAULT_CONTROLS) {
9083
  // Always add the `none` option if not exists.
9084
  if (!controls.includes('none')) {
9085
+ controls = ['none', ...controls];
9086
  }
9087
 
9088
  const {
9103
  const layoutAlignments = layoutType.getAlignments(layout);
9104
 
9105
  if (themeSupportsLayout) {
9106
+ const alignments = layoutAlignments.filter(({
9107
  name: alignmentName
9108
+ }) => controls.includes(alignmentName)); // While we treat `none` as an alignment, we shouldn't return it if no
9109
+ // other alignments exist.
9110
+
9111
+ if (alignments.length === 1 && alignments[0].name === 'none') {
9112
+ return [];
9113
+ }
9114
+
9115
+ return alignments;
9116
  } // Starting here, it's the fallback for themes not supporting the layout config.
9117
 
9118
 
9126
  const enabledControls = controls.filter(control => (layout.alignments || // Ignore the global wideAlignment check if the layout explicitely defines alignments.
9127
  wideControlsEnabled || !WIDE_CONTROLS.includes(control)) && availableAlignments.includes(control)).map(enabledControl => ({
9128
  name: enabledControl
9129
+ })); // While we treat `none` as an alignment, we shouldn't return it if no
9130
+ // other alignments exist.
9131
+
9132
+ if (enabledControls.length === 1 && enabledControls[0].name === 'none') {
9133
+ return [];
9134
+ }
9135
+
9136
  return enabledControls;
9137
  }
9138
  //# sourceMappingURL=use-available-alignments.js.map
9346
  validAlignments = ALL_ALIGNMENTS.filter(value => blockAlign.includes(value));
9347
  } else if (blockAlign === true) {
9348
  // `true` includes all alignments...
9349
+ validAlignments = [...ALL_ALIGNMENTS];
9350
  } else {
9351
  validAlignments = [];
9352
  }
9397
  const withToolbarControls = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => {
9398
  const {
9399
  name: blockName
9400
+ } = props; // Compute the block valid alignments by taking into account,
9401
+ // if the theme supports wide alignments or not and the layout's
9402
+ // availble alignments. We do that for conditionally rendering
9403
+ // Slot.
9404
 
9405
  const blockAllowedAlignments = getValidAlignments((0,external_wp_blocks_namespaceObject.getBlockSupport)(blockName, 'align'), (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockName, 'alignWide', true));
9406
+ const validAlignments = useAvailableAlignments(blockAllowedAlignments).map(({
9407
+ name
9408
+ }) => name);
9409
 
9410
  const updateAlignment = nextAlign => {
9411
  if (!nextAlign) {
9424
  });
9425
  };
9426
 
9427
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, !!validAlignments.length && (0,external_wp_element_namespaceObject.createElement)(block_controls, {
9428
  group: "block",
9429
  __experimentalShareWithChildBlocks: true
9430
  }, (0,external_wp_element_namespaceObject.createElement)(BlockAlignmentControl, {
9431
  value: props.attributes.align,
9432
  onChange: updateAlignment,
9433
+ controls: validAlignments
9434
  })), (0,external_wp_element_namespaceObject.createElement)(BlockEdit, props));
9435
  }, 'withToolbarControls');
9436
  /**
9557
  ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inspector-controls/fill.js
9558
 
9559
 
9560
+ /**
9561
+ * External dependencies
9562
+ */
9563
+
9564
  /**
9565
  * WordPress dependencies
9566
  */
9567
 
9568
 
9569
+
9570
  /**
9571
  * Internal dependencies
9572
  */
9593
 
9594
  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalStyleProvider, {
9595
  document: document
9596
+ }, (0,external_wp_element_namespaceObject.createElement)(Fill, null, fillProps => {
9597
+ // Children passed to InspectorControlsFill will not have
9598
+ // access to any React Context whose Provider is part of
9599
+ // the InspectorControlsSlot tree. So we re-create the
9600
+ // Provider in this subtree.
9601
+ const value = !(0,external_lodash_namespaceObject.isEmpty)(fillProps) ? fillProps : null;
9602
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelContext.Provider, {
9603
+ value: value
9604
+ }, children);
9605
+ }));
9606
  }
9607
  //# sourceMappingURL=fill.js.map
9608
  ;// CONCATENATED MODULE: ./packages/block-editor/build-module/hooks/utils.js
9642
 
9643
  function BlockSupportToolsPanel({
9644
  children,
9645
+ group,
9646
+ label
9647
  }) {
9648
  const {
9649
  clientId,
9683
  };
9684
 
9685
  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, {
9686
+ className: `${group}-block-support-panel`,
9687
  label: label,
 
9688
  resetAll: resetAll,
9689
  key: clientId,
9690
+ panelId: clientId,
9691
+ hasInnerWrapper: true,
9692
+ shouldRenderPlaceholderItems: true // Required to maintain fills ordering.
9693
+
9694
  }, children);
9695
  }
9696
  //# sourceMappingURL=block-support-tools-panel.js.map
9697
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inspector-controls/block-support-slot-container.js
9698
+
9699
+
9700
+
9701
+ /**
9702
+ * WordPress dependencies
9703
+ */
9704
+
9705
+
9706
+ function BlockSupportSlotContainer({
9707
+ Slot,
9708
+ ...props
9709
+ }) {
9710
+ const toolsPanelContext = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.__experimentalToolsPanelContext);
9711
+ return (0,external_wp_element_namespaceObject.createElement)(Slot, _extends({}, props, {
9712
+ fillProps: toolsPanelContext
9713
+ }));
9714
+ }
9715
+ //# sourceMappingURL=block-support-slot-container.js.map
9716
  ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inspector-controls/slot.js
9717
 
9718
 
9728
 
9729
 
9730
 
9731
+
9732
  function InspectorControlsSlot({
9733
  __experimentalGroup: group = 'default',
9734
  bubblesVirtually = true,
9755
  return (0,external_wp_element_namespaceObject.createElement)(BlockSupportToolsPanel, {
9756
  group: group,
9757
  label: label
9758
+ }, (0,external_wp_element_namespaceObject.createElement)(BlockSupportSlotContainer, _extends({}, props, {
9759
+ bubblesVirtually: bubblesVirtually,
9760
+ Slot: Slot
9761
  })));
9762
  }
9763
 
9874
  className: "html-anchor-control",
9875
  label: (0,external_wp_i18n_namespaceObject.__)('HTML anchor'),
9876
  help: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.'), isWeb && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
9877
+ href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/page-jumps/')
9878
  }, (0,external_wp_i18n_namespaceObject.__)('Learn more about anchors'))),
9879
  value: props.attributes.anchor || '',
9880
  placeholder: !isWeb ? (0,external_wp_i18n_namespaceObject.__)('Add an anchor') : null,
10057
  }
10058
  (0,external_wp_hooks_namespaceObject.addFilter)('blocks.getSaveContent.extraProps', 'core/generated-class-name/save-props', addGeneratedClassName);
10059
  //# sourceMappingURL=generated-class-name.js.map
10060
+ ;// CONCATENATED MODULE: external ["wp","dom"]
10061
+ var external_wp_dom_namespaceObject = window["wp"]["dom"];
10062
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-context/index.js
 
 
10063
 
 
 
10064
 
 
10065
  /**
10066
+ * WordPress dependencies
10067
  */
10068
 
10069
+ /** @typedef {import('react').ReactNode} ReactNode */
10070
 
 
 
 
10071
  /**
10072
+ * @typedef BlockContextProviderProps
 
 
 
 
 
10073
  *
10074
+ * @property {Record<string,*>} value Context value to merge with current
10075
+ * value.
10076
+ * @property {ReactNode} children Component children.
10077
  */
10078
 
10079
+ /** @type {import('react').Context<Record<string,*>>} */
 
 
 
 
 
 
 
 
 
10080
 
10081
+ const block_context_Context = (0,external_wp_element_namespaceObject.createContext)({});
 
 
 
10082
  /**
10083
+ * Component which merges passed value with current consumed block context.
10084
  *
10085
+ * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-context/README.md
 
10086
  *
10087
+ * @param {BlockContextProviderProps} props
 
10088
  */
10089
 
10090
+ function BlockContextProvider({
10091
+ value,
10092
+ children
10093
+ }) {
10094
+ const context = (0,external_wp_element_namespaceObject.useContext)(block_context_Context);
10095
+ const nextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...context,
10096
+ ...value
10097
+ }), [context, value]);
10098
+ return (0,external_wp_element_namespaceObject.createElement)(block_context_Context.Provider, {
10099
+ value: nextValue,
10100
+ children: children
10101
  });
10102
+ }
10103
+ /* harmony default export */ var block_context = (block_context_Context);
10104
+ //# sourceMappingURL=index.js.map
10105
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-edit/edit.js
 
 
 
 
 
 
10106
 
 
 
 
 
10107
 
 
 
 
 
 
 
 
 
 
 
10108
 
 
 
 
 
 
 
 
 
10109
  /**
10110
  * External dependencies
10111
  */
10112
 
10113
+
10114
  /**
10115
  * WordPress dependencies
10116
  */
10117
 
10118
 
10119
 
10120
+
10121
  /**
10122
  * Internal dependencies
10123
  */
10124
 
10125
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10126
  /**
10127
+ * Default value used for blocks which do not define their own context needs,
10128
+ * used to guarantee that a block's `context` prop will always be an object. It
10129
+ * is assigned as a constant since it is always expected to be an empty object,
10130
+ * and in order to avoid unnecessary React reconciliations of a changing object.
10131
  *
10132
+ * @type {{}}
 
 
10133
  */
10134
 
10135
+ const DEFAULT_BLOCK_CONTEXT = {};
10136
+ const Edit = props => {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10137
  const {
10138
+ attributes = {},
10139
+ name
10140
+ } = props;
10141
+ const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
10142
+ const blockContext = (0,external_wp_element_namespaceObject.useContext)(block_context); // Assign context values using the block type's declared context needs.
10143
 
10144
+ const context = (0,external_wp_element_namespaceObject.useMemo)(() => {
10145
+ return blockType && blockType.usesContext ? (0,external_lodash_namespaceObject.pick)(blockContext, blockType.usesContext) : DEFAULT_BLOCK_CONTEXT;
10146
+ }, [blockType, blockContext]);
 
 
 
 
10147
 
10148
+ if (!blockType) {
10149
+ return null;
10150
+ } // `edit` and `save` are functions or components describing the markup
10151
+ // with which a block is displayed. If `blockType` is valid, assign
10152
+ // them preferentially as the render value for the block.
10153
 
 
10154
 
10155
+ const Component = blockType.edit || blockType.save;
10156
 
10157
+ if (blockType.apiVersion > 1) {
10158
+ return (0,external_wp_element_namespaceObject.createElement)(Component, _extends({}, props, {
10159
+ context: context
10160
+ }));
10161
+ } // Generate a class name for the block's editable form
10162
 
 
 
 
 
 
 
 
 
10163
 
10164
+ const generatedClassName = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'className', true) ? (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(name) : null;
10165
+ const className = classnames_default()(generatedClassName, attributes.className);
10166
+ return (0,external_wp_element_namespaceObject.createElement)(Component, _extends({}, props, {
10167
+ context: context,
10168
+ className: className
10169
+ }));
10170
+ };
10171
+ /* harmony default export */ var edit = ((0,external_wp_components_namespaceObject.withFilters)('editor.BlockEdit')(Edit));
10172
+ //# sourceMappingURL=edit.js.map
10173
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-edit/index.js
10174
 
10175
 
10176
  /**
10177
+ * WordPress dependencies
10178
  */
10179
 
 
10180
  /**
10181
+ * Internal dependencies
10182
  */
10183
 
10184
 
10185
 
10186
 
10187
+ function BlockEdit(props) {
10188
+ const {
10189
+ name,
10190
+ isSelected,
10191
+ clientId
10192
+ } = props;
10193
+ const context = {
10194
+ name,
10195
+ isSelected,
10196
+ clientId
10197
+ };
10198
+ return (0,external_wp_element_namespaceObject.createElement)(Provider // It is important to return the same object if props haven't
10199
+ // changed to avoid unnecessary rerenders.
10200
+ // See https://reactjs.org/docs/context.html#caveats.
10201
+ , {
10202
+ value: (0,external_wp_element_namespaceObject.useMemo)(() => context, Object.values(context))
10203
+ }, (0,external_wp_element_namespaceObject.createElement)(edit, props));
10204
+ }
10205
+ //# sourceMappingURL=index.js.map
10206
+ ;// CONCATENATED MODULE: ./packages/icons/build-module/library/more-horizontal.js
10207
 
10208
 
10209
+ /**
10210
+ * WordPress dependencies
10211
+ */
10212
 
10213
+ const moreHorizontal = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
10214
+ xmlns: "http://www.w3.org/2000/svg",
10215
+ viewBox: "0 0 24 24"
10216
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
10217
+ d: "M11 13h2v-2h-2v2zm-6 0h2v-2H5v2zm12-2v2h2v-2h-2z"
10218
+ }));
10219
+ /* harmony default export */ var more_horizontal = (moreHorizontal);
10220
+ //# sourceMappingURL=more-horizontal.js.map
10221
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/warning/index.js
10222
 
10223
 
10224
+ /**
10225
+ * External dependencies
10226
+ */
10227
 
10228
+ /**
10229
+ * WordPress dependencies
10230
+ */
10231
 
 
 
 
 
 
 
 
 
 
10232
 
 
 
 
 
 
 
 
 
 
10233
 
 
10234
 
 
 
 
10235
 
 
 
 
 
 
10236
 
10237
+ function Warning({
 
 
 
 
10238
  className,
10239
+ actions,
10240
+ children,
10241
+ secondaryActions
 
 
 
10242
  }) {
10243
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
10244
+ className: classnames_default()(className, 'block-editor-warning')
10245
+ }, (0,external_wp_element_namespaceObject.createElement)("div", {
10246
+ className: "block-editor-warning__contents"
10247
+ }, (0,external_wp_element_namespaceObject.createElement)("p", {
10248
+ className: "block-editor-warning__message"
10249
+ }, children), (external_wp_element_namespaceObject.Children.count(actions) > 0 || secondaryActions) && (0,external_wp_element_namespaceObject.createElement)("div", {
10250
+ className: "block-editor-warning__actions"
10251
+ }, external_wp_element_namespaceObject.Children.count(actions) > 0 && external_wp_element_namespaceObject.Children.map(actions, (action, i) => (0,external_wp_element_namespaceObject.createElement)("span", {
10252
+ key: i,
10253
+ className: "block-editor-warning__action"
10254
+ }, action)), secondaryActions && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
10255
+ className: "block-editor-warning__secondary",
10256
+ icon: more_horizontal,
10257
+ label: (0,external_wp_i18n_namespaceObject.__)('More options'),
10258
+ popoverProps: {
10259
+ position: 'bottom left',
10260
+ className: 'block-editor-warning__dropdown'
10261
+ },
10262
+ noIcons: true
10263
+ }, () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, secondaryActions.map((item, pos) => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
10264
+ onClick: item.onClick,
10265
+ key: pos
10266
+ }, item.title)))))));
10267
+ }
10268
+ /**
10269
+ * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/warning/README.md
10270
+ */
10271
 
 
 
 
10272
 
10273
+ /* harmony default export */ var warning = (Warning);
10274
+ //# sourceMappingURL=index.js.map
10275
+ // EXTERNAL MODULE: ./node_modules/diff/lib/diff/character.js
10276
+ var character = __webpack_require__(7630);
10277
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-compare/block-view.js
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10278
 
 
 
 
 
 
 
 
 
10279
 
10280
+ /**
10281
+ * WordPress dependencies
10282
+ */
 
10283
 
 
 
10284
 
 
 
 
10285
 
10286
+ function BlockView({
10287
+ title,
10288
+ rawContent,
10289
+ renderedContent,
10290
+ action,
10291
+ actionText,
10292
+ className
10293
+ }) {
10294
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
10295
+ className: className
10296
+ }, (0,external_wp_element_namespaceObject.createElement)("div", {
10297
+ className: "block-editor-block-compare__content"
10298
+ }, (0,external_wp_element_namespaceObject.createElement)("h2", {
10299
+ className: "block-editor-block-compare__heading"
10300
+ }, title), (0,external_wp_element_namespaceObject.createElement)("div", {
10301
+ className: "block-editor-block-compare__html"
10302
+ }, rawContent), (0,external_wp_element_namespaceObject.createElement)("div", {
10303
+ className: "block-editor-block-compare__preview edit-post-visual-editor"
10304
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, (0,external_wp_dom_namespaceObject.safeHTML)(renderedContent)))), (0,external_wp_element_namespaceObject.createElement)("div", {
10305
+ className: "block-editor-block-compare__action"
10306
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
10307
+ variant: "secondary",
10308
+ tabIndex: "0",
10309
+ onClick: action
10310
+ }, actionText)));
10311
+ }
10312
+ //# sourceMappingURL=block-view.js.map
10313
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-compare/index.js
10314
 
10315
 
10316
  /**
10317
  * External dependencies
10318
  */
10319
 
10320
+ // diff doesn't tree-shake correctly, so we import from the individual
10321
+ // module here, to avoid including too much of the library
10322
+
10323
+
10324
  /**
10325
  * WordPress dependencies
10326
  */
10327
 
10328
 
10329
 
 
 
10330
  /**
10331
  * Internal dependencies
10332
  */
10333
 
10334
 
10335
 
10336
+ function BlockCompare({
10337
+ block,
10338
+ onKeep,
10339
+ onConvert,
10340
+ convertor,
10341
+ convertButtonText
10342
+ }) {
10343
+ function getDifference(originalContent, newContent) {
10344
+ const difference = (0,character/* diffChars */.Kx)(originalContent, newContent);
10345
+ return difference.map((item, pos) => {
10346
+ const classes = classnames_default()({
10347
+ 'block-editor-block-compare__added': item.added,
10348
+ 'block-editor-block-compare__removed': item.removed
10349
+ });
10350
+ return (0,external_wp_element_namespaceObject.createElement)("span", {
10351
+ key: pos,
10352
+ className: classes
10353
+ }, item.value);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10354
  });
10355
+ }
10356
 
10357
+ function getConvertedContent(convertedBlock) {
10358
+ // The convertor may return an array of items or a single item
10359
+ const newBlocks = (0,external_lodash_namespaceObject.castArray)(convertedBlock); // Get converted block details
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10360
 
10361
+ const newContent = newBlocks.map(item => (0,external_wp_blocks_namespaceObject.getSaveContent)(item.name, item.attributes, item.innerBlocks));
10362
+ return newContent.join('');
10363
+ }
 
10364
 
10365
+ const converted = getConvertedContent(convertor(block));
10366
+ const difference = getDifference(block.originalContent, converted);
10367
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
10368
+ className: "block-editor-block-compare__wrapper"
10369
+ }, (0,external_wp_element_namespaceObject.createElement)(BlockView, {
10370
+ title: (0,external_wp_i18n_namespaceObject.__)('Current'),
10371
+ className: "block-editor-block-compare__current",
10372
+ action: onKeep,
10373
+ actionText: (0,external_wp_i18n_namespaceObject.__)('Convert to HTML'),
10374
+ rawContent: block.originalContent,
10375
+ renderedContent: block.originalContent
10376
+ }), (0,external_wp_element_namespaceObject.createElement)(BlockView, {
10377
+ title: (0,external_wp_i18n_namespaceObject.__)('After Conversion'),
10378
+ className: "block-editor-block-compare__converted",
10379
+ action: onConvert,
10380
+ actionText: convertButtonText,
10381
+ rawContent: difference,
10382
+ renderedContent: converted
10383
+ }));
10384
+ }
10385
 
10386
+ /* harmony default export */ var block_compare = (BlockCompare);
10387
+ //# sourceMappingURL=index.js.map
10388
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/block-invalid-warning.js
10389
 
10390
 
 
 
 
 
 
 
 
 
10391
  /**
10392
+ * WordPress dependencies
 
 
 
 
 
 
10393
  */
10394
 
10395
 
 
 
10396
 
 
 
 
10397
 
 
 
 
 
 
 
 
 
 
 
10398
 
10399
+
 
 
10400
  /**
10401
+ * Internal dependencies
 
 
 
 
 
10402
  */
10403
 
10404
 
 
 
 
 
10405
 
 
10406
 
10407
+ function BlockInvalidWarning({
10408
+ convertToHTML,
10409
+ convertToBlocks,
10410
+ convertToClassic,
10411
+ attemptBlockRecovery,
10412
+ block
10413
+ }) {
10414
+ const hasHTMLBlock = !!(0,external_wp_blocks_namespaceObject.getBlockType)('core/html');
10415
+ const [compare, setCompare] = (0,external_wp_element_namespaceObject.useState)(false);
10416
+ const onCompare = (0,external_wp_element_namespaceObject.useCallback)(() => setCompare(true), []);
10417
+ const onCompareClose = (0,external_wp_element_namespaceObject.useCallback)(() => setCompare(false), []); // We memo the array here to prevent the children components from being updated unexpectedly
10418
 
10419
+ const hiddenActions = (0,external_wp_element_namespaceObject.useMemo)(() => [{
10420
+ // translators: Button to fix block content
10421
+ title: (0,external_wp_i18n_namespaceObject._x)('Resolve', 'imperative verb'),
10422
+ onClick: onCompare
10423
+ }, hasHTMLBlock && {
10424
+ title: (0,external_wp_i18n_namespaceObject.__)('Convert to HTML'),
10425
+ onClick: convertToHTML
10426
+ }, {
10427
+ title: (0,external_wp_i18n_namespaceObject.__)('Convert to Classic Block'),
10428
+ onClick: convertToClassic
10429
+ }].filter(Boolean), [onCompare, convertToHTML, convertToClassic]);
10430
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(warning, {
10431
+ actions: [(0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
10432
+ key: "recover",
10433
+ onClick: attemptBlockRecovery,
10434
+ variant: "primary"
10435
+ }, (0,external_wp_i18n_namespaceObject.__)('Attempt Block Recovery'))],
10436
+ secondaryActions: hiddenActions
10437
+ }, (0,external_wp_i18n_namespaceObject.__)('This block contains unexpected or invalid content.')), compare && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
10438
+ title: // translators: Dialog title to fix block content
10439
+ (0,external_wp_i18n_namespaceObject.__)('Resolve Block'),
10440
+ onRequestClose: onCompareClose,
10441
+ className: "block-editor-block-compare"
10442
+ }, (0,external_wp_element_namespaceObject.createElement)(block_compare, {
10443
+ block: block,
10444
+ onKeep: convertToHTML,
10445
+ onConvert: convertToBlocks,
10446
+ convertor: blockToBlocks,
10447
+ convertButtonText: (0,external_wp_i18n_namespaceObject.__)('Convert to Blocks')
10448
+ })));
10449
+ }
10450
 
10451
+ const blockToClassic = block => (0,external_wp_blocks_namespaceObject.createBlock)('core/freeform', {
10452
+ content: block.originalContent
10453
+ });
10454
 
10455
+ const blockToHTML = block => (0,external_wp_blocks_namespaceObject.createBlock)('core/html', {
10456
+ content: block.originalContent
10457
+ });
 
 
 
 
 
 
 
10458
 
10459
+ const blockToBlocks = block => (0,external_wp_blocks_namespaceObject.rawHandler)({
10460
+ HTML: block.originalContent
10461
+ });
10462
 
10463
+ const recoverBlock = ({
10464
+ name,
10465
+ attributes,
10466
+ innerBlocks
10467
+ }) => (0,external_wp_blocks_namespaceObject.createBlock)(name, attributes, innerBlocks);
10468
 
10469
+ /* harmony default export */ var block_invalid_warning = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, {
10470
+ clientId
10471
+ }) => ({
10472
+ block: select(store).getBlock(clientId)
10473
+ })), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, {
10474
+ block
10475
+ }) => {
10476
  const {
10477
+ replaceBlock
10478
+ } = dispatch(store);
10479
+ return {
10480
+ convertToClassic() {
10481
+ replaceBlock(block.clientId, blockToClassic(block));
10482
+ },
 
10483
 
10484
+ convertToHTML() {
10485
+ replaceBlock(block.clientId, blockToHTML(block));
10486
+ },
10487
 
10488
+ convertToBlocks() {
10489
+ replaceBlock(block.clientId, blockToBlocks(block));
10490
+ },
10491
+
10492
+ attemptBlockRecovery() {
10493
+ replaceBlock(block.clientId, recoverBlock(block));
 
10494
  }
10495
+
10496
  };
10497
+ })])(BlockInvalidWarning));
10498
+ //# sourceMappingURL=block-invalid-warning.js.map
10499
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/block-crash-warning.js
 
 
 
 
 
 
 
 
 
 
10500
 
 
 
 
 
 
 
 
10501
 
 
 
 
10502
  /**
10503
+ * WordPress dependencies
 
 
 
10504
  */
10505
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10506
  /**
10507
+ * Internal dependencies
 
 
 
10508
  */
10509
 
 
 
 
 
 
 
 
 
 
10510
 
10511
+ const block_crash_warning_warning = (0,external_wp_element_namespaceObject.createElement)(warning, {
10512
+ className: "block-editor-block-list__block-crash-warning"
10513
+ }, (0,external_wp_i18n_namespaceObject.__)('This block has encountered an error and cannot be previewed.'));
10514
+ /* harmony default export */ var block_crash_warning = (() => block_crash_warning_warning);
10515
+ //# sourceMappingURL=block-crash-warning.js.map
10516
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/block-crash-boundary.js
 
 
10517
  /**
10518
+ * WordPress dependencies
 
 
 
10519
  */
10520
 
 
 
 
 
 
 
 
 
 
 
 
10521
 
10522
+ class BlockCrashBoundary extends external_wp_element_namespaceObject.Component {
10523
+ constructor() {
10524
+ super(...arguments);
10525
+ this.state = {
10526
+ hasError: false
10527
+ };
10528
+ }
10529
 
10530
+ componentDidCatch() {
10531
+ this.setState({
10532
+ hasError: true
10533
+ });
10534
+ }
10535
 
10536
+ render() {
10537
+ if (this.state.hasError) {
10538
+ return this.props.fallback;
10539
+ }
10540
 
10541
+ return this.props.children;
10542
+ }
10543
 
 
 
 
 
10544
  }
 
 
10545
 
10546
+ /* harmony default export */ var block_crash_boundary = (BlockCrashBoundary);
10547
+ //# sourceMappingURL=block-crash-boundary.js.map
10548
+ // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js
10549
+ var lib = __webpack_require__(4042);
10550
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/block-html.js
10551
 
10552
 
10553
  /**
10554
+ * External dependencies
10555
  */
10556
 
 
10557
  /**
10558
+ * WordPress dependencies
10559
  */
10560
 
10561
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10562
 
10563
 
10564
  /**
10565
+ * Internal dependencies
10566
  */
10567
 
10568
 
10569
+
10570
+ function BlockHTML({
10571
+ clientId
 
 
 
 
 
 
 
10572
  }) {
10573
+ const [html, setHtml] = (0,external_wp_element_namespaceObject.useState)('');
10574
+ const block = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getBlock(clientId), [clientId]);
10575
+ const {
10576
+ updateBlock
10577
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
10578
+
10579
+ const onChange = () => {
10580
+ const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name);
10581
+
10582
+ if (!blockType) {
10583
  return;
10584
  }
10585
 
10586
+ const attributes = (0,external_wp_blocks_namespaceObject.getBlockAttributes)(blockType, html, block.attributes); // If html is empty we reset the block to the default HTML and mark it as valid to avoid triggering an error
 
 
 
10587
 
10588
+ const content = html ? html : (0,external_wp_blocks_namespaceObject.getSaveContent)(blockType, attributes);
10589
+ const isValid = html ? (0,external_wp_blocks_namespaceObject.isValidBlockContent)(blockType, attributes, content) : true;
10590
+ updateBlock(clientId, {
10591
+ attributes,
10592
+ originalContent: content,
10593
+ isValid
10594
+ }); // Ensure the state is updated if we reset so it displays the default content
10595
 
10596
+ if (!html) {
10597
+ setHtml({
10598
+ content
10599
+ });
10600
+ }
10601
+ };
10602
 
10603
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
10604
+ setHtml((0,external_wp_blocks_namespaceObject.getBlockContent)(block));
10605
+ }, [block]);
10606
+ return (0,external_wp_element_namespaceObject.createElement)(lib/* default */.Z, {
10607
+ className: "block-editor-block-list__block-html-textarea",
10608
+ value: html,
10609
+ onBlur: onChange,
10610
+ onChange: event => setHtml(event.target.value)
10611
+ });
10612
  }
 
 
10613
 
10614
+ /* harmony default export */ var block_html = (BlockHTML);
10615
+ //# sourceMappingURL=block-html.js.map
10616
+ ;// CONCATENATED MODULE: ./node_modules/@react-spring/rafz/dist/react-spring-rafz.esm.js
10617
+ let updateQueue = makeQueue();
10618
+ const raf = fn => schedule(fn, updateQueue);
10619
+ let writeQueue = makeQueue();
10620
 
10621
+ raf.write = fn => schedule(fn, writeQueue);
 
 
10622
 
10623
+ let onStartQueue = makeQueue();
 
 
 
 
 
 
 
 
10624
 
10625
+ raf.onStart = fn => schedule(fn, onStartQueue);
10626
 
10627
+ let onFrameQueue = makeQueue();
 
 
10628
 
10629
+ raf.onFrame = fn => schedule(fn, onFrameQueue);
 
 
 
 
 
 
 
 
10630
 
10631
+ let onFinishQueue = makeQueue();
10632
 
10633
+ raf.onFinish = fn => schedule(fn, onFinishQueue);
10634
 
10635
+ let timeouts = [];
 
 
10636
 
10637
+ raf.setTimeout = (handler, ms) => {
10638
+ let time = raf.now() + ms;
10639
 
10640
+ let cancel = () => {
10641
+ let i = timeouts.findIndex(t => t.cancel == cancel);
10642
+ if (~i) timeouts.splice(i, 1);
10643
+ __raf.count -= ~i ? 1 : 0;
10644
+ };
10645
 
10646
+ let timeout = {
10647
+ time,
10648
+ handler,
10649
+ cancel
10650
+ };
10651
+ timeouts.splice(findTimeout(time), 0, timeout);
10652
+ __raf.count += 1;
10653
+ start();
10654
+ return timeout;
10655
+ };
 
 
 
 
 
 
 
 
 
10656
 
10657
+ let findTimeout = time => ~(~timeouts.findIndex(t => t.time > time) || ~timeouts.length);
10658
 
10659
+ raf.cancel = fn => {
10660
+ updateQueue.delete(fn);
10661
+ writeQueue.delete(fn);
10662
+ };
10663
 
10664
+ raf.sync = fn => {
10665
+ sync = true;
10666
+ raf.batchedUpdates(fn);
10667
+ sync = false;
10668
+ };
10669
 
10670
+ raf.throttle = fn => {
10671
+ let lastArgs;
10672
 
10673
+ function queuedFn() {
10674
+ try {
10675
+ fn(...lastArgs);
10676
+ } finally {
10677
+ lastArgs = null;
10678
+ }
10679
+ }
10680
+
10681
+ function throttled(...args) {
10682
+ lastArgs = args;
10683
+ raf.onStart(queuedFn);
10684
+ }
10685
+
10686
+ throttled.handler = fn;
10687
 
10688
+ throttled.cancel = () => {
10689
+ onStartQueue.delete(queuedFn);
10690
+ lastArgs = null;
10691
+ };
10692
 
10693
+ return throttled;
10694
+ };
10695
 
10696
+ let nativeRaf = typeof window != 'undefined' ? window.requestAnimationFrame : () => {};
10697
 
10698
+ raf.use = impl => nativeRaf = impl;
10699
 
10700
+ raf.now = typeof performance != 'undefined' ? () => performance.now() : Date.now;
10701
 
10702
+ raf.batchedUpdates = fn => fn();
10703
+
10704
+ raf.catch = console.error;
10705
+ raf.frameLoop = 'always';
10706
+
10707
+ raf.advance = () => {
10708
+ if (raf.frameLoop !== 'demand') {
10709
+ console.warn('Cannot call the manual advancement of rafz whilst frameLoop is not set as demand');
10710
+ } else {
10711
+ update();
10712
+ }
10713
  };
 
 
 
 
 
 
 
 
 
10714
 
10715
+ let ts = -1;
10716
+ let sync = false;
 
 
 
 
 
 
 
 
 
 
10717
 
10718
+ function schedule(fn, queue) {
10719
+ if (sync) {
10720
+ queue.delete(fn);
10721
+ fn(0);
10722
+ } else {
10723
+ queue.add(fn);
10724
+ start();
10725
+ }
10726
+ }
10727
 
10728
+ function start() {
10729
+ if (ts < 0) {
10730
+ ts = 0;
10731
 
10732
+ if (raf.frameLoop !== 'demand') {
10733
+ nativeRaf(loop);
10734
+ }
10735
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10736
  }
 
 
10737
 
10738
+ function loop() {
10739
+ if (~ts) {
10740
+ nativeRaf(loop);
10741
+ raf.batchedUpdates(update);
10742
+ }
10743
+ }
10744
 
10745
+ function update() {
10746
+ let prevTs = ts;
10747
+ ts = raf.now();
10748
+ let count = findTimeout(ts);
10749
 
10750
+ if (count) {
10751
+ eachSafely(timeouts.splice(0, count), t => t.handler());
10752
+ __raf.count -= count;
10753
+ }
10754
 
10755
+ onStartQueue.flush();
10756
+ updateQueue.flush(prevTs ? Math.min(64, ts - prevTs) : 16.667);
10757
+ onFrameQueue.flush();
10758
+ writeQueue.flush();
10759
+ onFinishQueue.flush();
10760
+ }
 
10761
 
10762
+ function makeQueue() {
10763
+ let next = new Set();
10764
+ let current = next;
10765
+ return {
10766
+ add(fn) {
10767
+ __raf.count += current == next && !next.has(fn) ? 1 : 0;
10768
+ next.add(fn);
10769
+ },
10770
 
10771
+ delete(fn) {
10772
+ __raf.count -= current == next && next.has(fn) ? 1 : 0;
10773
+ return next.delete(fn);
10774
  },
 
 
10775
 
10776
+ flush(arg) {
10777
+ if (current.size) {
10778
+ next = new Set();
10779
+ __raf.count -= current.size;
10780
+ eachSafely(current, fn => fn(arg) && next.add(fn));
10781
+ __raf.count += next.size;
10782
+ current = next;
10783
  }
 
 
 
 
10784
  }
10785
 
 
 
 
10786
  };
10787
+ }
10788
 
10789
+ function eachSafely(values, each) {
10790
+ values.forEach(value => {
10791
+ try {
10792
+ each(value);
10793
+ } catch (e) {
10794
+ raf.catch(e);
10795
+ }
10796
  });
10797
  }
 
 
10798
 
10799
+ const __raf = {
10800
+ count: 0,
10801
 
10802
+ clear() {
10803
+ ts = -1;
10804
+ timeouts = [];
10805
+ onStartQueue = makeQueue();
10806
+ updateQueue = makeQueue();
10807
+ onFrameQueue = makeQueue();
10808
+ writeQueue = makeQueue();
10809
+ onFinishQueue = makeQueue();
10810
+ __raf.count = 0;
10811
+ }
 
 
 
 
 
10812
 
10813
+ };
10814
 
 
 
 
10815
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10816
 
10817
+ // EXTERNAL MODULE: external "React"
10818
+ var external_React_ = __webpack_require__(3804);
10819
+ var external_React_default = /*#__PURE__*/__webpack_require__.n(external_React_);
10820
+ ;// CONCATENATED MODULE: ./node_modules/@react-spring/shared/dist/react-spring-shared.esm.js
10821
 
 
 
 
10822
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10823
 
10824
 
 
 
 
10825
 
10826
+ function noop() {}
10827
+ const defineHidden = (obj, key, value) => Object.defineProperty(obj, key, {
10828
+ value,
10829
+ writable: true,
10830
+ configurable: true
10831
+ });
10832
+ const react_spring_shared_esm_is = {
10833
+ arr: Array.isArray,
10834
+ obj: a => !!a && a.constructor.name === 'Object',
10835
+ fun: a => typeof a === 'function',
10836
+ str: a => typeof a === 'string',
10837
+ num: a => typeof a === 'number',
10838
+ und: a => a === undefined
10839
+ };
10840
+ function isEqual(a, b) {
10841
+ if (react_spring_shared_esm_is.arr(a)) {
10842
+ if (!react_spring_shared_esm_is.arr(b) || a.length !== b.length) return false;
10843
 
10844
+ for (let i = 0; i < a.length; i++) {
10845
+ if (a[i] !== b[i]) return false;
10846
+ }
10847
 
10848
+ return true;
10849
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10850
 
10851
+ return a === b;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10852
  }
10853
+ const react_spring_shared_esm_each = (obj, fn) => obj.forEach(fn);
10854
+ function eachProp(obj, fn, ctx) {
10855
+ for (const key in obj) {
10856
+ if (obj.hasOwnProperty(key)) {
10857
+ fn.call(ctx, obj[key], key);
10858
+ }
10859
+ }
10860
+ }
10861
+ const react_spring_shared_esm_toArray = a => react_spring_shared_esm_is.und(a) ? [] : react_spring_shared_esm_is.arr(a) ? a : [a];
10862
+ function flush(queue, iterator) {
10863
+ if (queue.size) {
10864
+ const items = Array.from(queue);
10865
+ queue.clear();
10866
+ react_spring_shared_esm_each(items, iterator);
10867
+ }
10868
+ }
10869
+ const flushCalls = (queue, ...args) => flush(queue, fn => fn(...args));
10870
 
10871
+ let createStringInterpolator$1;
10872
+ let to;
10873
+ let colors$1 = null;
10874
+ let skipAnimation = false;
10875
+ let willAdvance = noop;
10876
+ const react_spring_shared_esm_assign = globals => {
10877
+ if (globals.to) to = globals.to;
10878
+ if (globals.now) raf.now = globals.now;
10879
+ if (globals.colors !== undefined) colors$1 = globals.colors;
10880
+ if (globals.skipAnimation != null) skipAnimation = globals.skipAnimation;
10881
+ if (globals.createStringInterpolator) createStringInterpolator$1 = globals.createStringInterpolator;
10882
+ if (globals.requestAnimationFrame) raf.use(globals.requestAnimationFrame);
10883
+ if (globals.batchedUpdates) raf.batchedUpdates = globals.batchedUpdates;
10884
+ if (globals.willAdvance) willAdvance = globals.willAdvance;
10885
+ if (globals.frameLoop) raf.frameLoop = globals.frameLoop;
10886
+ };
10887
 
10888
+ var globals = /*#__PURE__*/Object.freeze({
10889
+ __proto__: null,
10890
+ get createStringInterpolator () { return createStringInterpolator$1; },
10891
+ get to () { return to; },
10892
+ get colors () { return colors$1; },
10893
+ get skipAnimation () { return skipAnimation; },
10894
+ get willAdvance () { return willAdvance; },
10895
+ assign: react_spring_shared_esm_assign
10896
+ });
10897
 
10898
+ const startQueue = new Set();
10899
+ let currentFrame = [];
10900
+ let prevFrame = [];
10901
+ let priority = 0;
10902
+ const frameLoop = {
10903
+ get idle() {
10904
+ return !startQueue.size && !currentFrame.length;
10905
+ },
10906
 
10907
+ start(animation) {
10908
+ if (priority > animation.priority) {
10909
+ startQueue.add(animation);
10910
+ raf.onStart(flushStartQueue);
10911
+ } else {
10912
+ startSafely(animation);
10913
+ raf(advance);
10914
+ }
10915
+ },
10916
 
10917
+ advance,
 
10918
 
10919
+ sort(animation) {
10920
+ if (priority) {
10921
+ raf.onFrame(() => frameLoop.sort(animation));
10922
+ } else {
10923
+ const prevIndex = currentFrame.indexOf(animation);
 
10924
 
10925
+ if (~prevIndex) {
10926
+ currentFrame.splice(prevIndex, 1);
10927
+ startUnsafely(animation);
 
10928
  }
10929
+ }
10930
+ },
10931
+
10932
+ clear() {
10933
+ currentFrame = [];
10934
+ startQueue.clear();
10935
+ }
10936
 
 
 
 
 
10937
  };
 
 
10938
 
10939
+ function flushStartQueue() {
10940
+ startQueue.forEach(startSafely);
10941
+ startQueue.clear();
10942
+ raf(advance);
10943
+ }
10944
 
10945
+ function startSafely(animation) {
10946
+ if (!currentFrame.includes(animation)) startUnsafely(animation);
10947
+ }
10948
 
10949
+ function startUnsafely(animation) {
10950
+ currentFrame.splice(findIndex(currentFrame, other => other.priority > animation.priority), 0, animation);
10951
+ }
10952
 
10953
+ function advance(dt) {
10954
+ const nextFrame = prevFrame;
10955
 
10956
+ for (let i = 0; i < currentFrame.length; i++) {
10957
+ const animation = currentFrame[i];
10958
+ priority = animation.priority;
10959
 
10960
+ if (!animation.idle) {
10961
+ willAdvance(animation);
10962
+ animation.advance(dt);
10963
 
10964
+ if (!animation.idle) {
10965
+ nextFrame.push(animation);
10966
+ }
10967
+ }
10968
+ }
10969
 
10970
+ priority = 0;
10971
+ prevFrame = currentFrame;
10972
+ prevFrame.length = 0;
10973
+ currentFrame = nextFrame;
10974
+ return currentFrame.length > 0;
10975
+ }
 
 
10976
 
10977
+ function findIndex(arr, test) {
10978
+ const index = arr.findIndex(test);
10979
+ return index < 0 ? arr.length : index;
10980
+ }
 
 
 
 
 
 
 
 
 
 
 
 
10981
 
10982
+ const colors = {
10983
+ transparent: 0x00000000,
10984
+ aliceblue: 0xf0f8ffff,
10985
+ antiquewhite: 0xfaebd7ff,
10986
+ aqua: 0x00ffffff,
10987
+ aquamarine: 0x7fffd4ff,
10988
+ azure: 0xf0ffffff,
10989
+ beige: 0xf5f5dcff,
10990
+ bisque: 0xffe4c4ff,
10991
+ black: 0x000000ff,
10992
+ blanchedalmond: 0xffebcdff,
10993
+ blue: 0x0000ffff,
10994
+ blueviolet: 0x8a2be2ff,
10995
+ brown: 0xa52a2aff,
10996
+ burlywood: 0xdeb887ff,
10997
+ burntsienna: 0xea7e5dff,
10998
+ cadetblue: 0x5f9ea0ff,
10999
+ chartreuse: 0x7fff00ff,
11000
+ chocolate: 0xd2691eff,
11001
+ coral: 0xff7f50ff,
11002
+ cornflowerblue: 0x6495edff,
11003
+ cornsilk: 0xfff8dcff,
11004
+ crimson: 0xdc143cff,
11005
+ cyan: 0x00ffffff,
11006
+ darkblue: 0x00008bff,
11007
+ darkcyan: 0x008b8bff,
11008
+ darkgoldenrod: 0xb8860bff,
11009
+ darkgray: 0xa9a9a9ff,
11010
+ darkgreen: 0x006400ff,
11011
+ darkgrey: 0xa9a9a9ff,
11012
+ darkkhaki: 0xbdb76bff,
11013
+ darkmagenta: 0x8b008bff,
11014
+ darkolivegreen: 0x556b2fff,
11015
+ darkorange: 0xff8c00ff,
11016
+ darkorchid: 0x9932ccff,
11017
+ darkred: 0x8b0000ff,
11018
+ darksalmon: 0xe9967aff,
11019
+ darkseagreen: 0x8fbc8fff,
11020
+ darkslateblue: 0x483d8bff,
11021
+ darkslategray: 0x2f4f4fff,
11022
+ darkslategrey: 0x2f4f4fff,
11023
+ darkturquoise: 0x00ced1ff,
11024
+ darkviolet: 0x9400d3ff,
11025
+ deeppink: 0xff1493ff,
11026
+ deepskyblue: 0x00bfffff,
11027
+ dimgray: 0x696969ff,
11028
+ dimgrey: 0x696969ff,
11029
+ dodgerblue: 0x1e90ffff,
11030
+ firebrick: 0xb22222ff,
11031
+ floralwhite: 0xfffaf0ff,
11032
+ forestgreen: 0x228b22ff,
11033
+ fuchsia: 0xff00ffff,
11034
+ gainsboro: 0xdcdcdcff,
11035
+ ghostwhite: 0xf8f8ffff,
11036
+ gold: 0xffd700ff,
11037
+ goldenrod: 0xdaa520ff,
11038
+ gray: 0x808080ff,
11039
+ green: 0x008000ff,
11040
+ greenyellow: 0xadff2fff,
11041
+ grey: 0x808080ff,
11042
+ honeydew: 0xf0fff0ff,
11043
+ hotpink: 0xff69b4ff,
11044
+ indianred: 0xcd5c5cff,
11045
+ indigo: 0x4b0082ff,
11046
+ ivory: 0xfffff0ff,
11047
+ khaki: 0xf0e68cff,
11048
+ lavender: 0xe6e6faff,
11049
+ lavenderblush: 0xfff0f5ff,
11050
+ lawngreen: 0x7cfc00ff,
11051
+ lemonchiffon: 0xfffacdff,
11052
+ lightblue: 0xadd8e6ff,
11053
+ lightcoral: 0xf08080ff,
11054
+ lightcyan: 0xe0ffffff,
11055
+ lightgoldenrodyellow: 0xfafad2ff,
11056
+ lightgray: 0xd3d3d3ff,
11057
+ lightgreen: 0x90ee90ff,
11058
+ lightgrey: 0xd3d3d3ff,
11059
+ lightpink: 0xffb6c1ff,
11060
+ lightsalmon: 0xffa07aff,
11061
+ lightseagreen: 0x20b2aaff,
11062
+ lightskyblue: 0x87cefaff,
11063
+ lightslategray: 0x778899ff,
11064
+ lightslategrey: 0x778899ff,
11065
+ lightsteelblue: 0xb0c4deff,
11066
+ lightyellow: 0xffffe0ff,
11067
+ lime: 0x00ff00ff,
11068
+ limegreen: 0x32cd32ff,
11069
+ linen: 0xfaf0e6ff,
11070
+ magenta: 0xff00ffff,
11071
+ maroon: 0x800000ff,
11072
+ mediumaquamarine: 0x66cdaaff,
11073
+ mediumblue: 0x0000cdff,
11074
+ mediumorchid: 0xba55d3ff,
11075
+ mediumpurple: 0x9370dbff,
11076
+ mediumseagreen: 0x3cb371ff,
11077
+ mediumslateblue: 0x7b68eeff,
11078
+ mediumspringgreen: 0x00fa9aff,
11079
+ mediumturquoise: 0x48d1ccff,
11080
+ mediumvioletred: 0xc71585ff,
11081
+ midnightblue: 0x191970ff,
11082
+ mintcream: 0xf5fffaff,
11083
+ mistyrose: 0xffe4e1ff,
11084
+ moccasin: 0xffe4b5ff,
11085
+ navajowhite: 0xffdeadff,
11086
+ navy: 0x000080ff,
11087
+ oldlace: 0xfdf5e6ff,
11088
+ olive: 0x808000ff,
11089
+ olivedrab: 0x6b8e23ff,
11090
+ orange: 0xffa500ff,
11091
+ orangered: 0xff4500ff,
11092
+ orchid: 0xda70d6ff,
11093
+ palegoldenrod: 0xeee8aaff,
11094
+ palegreen: 0x98fb98ff,
11095
+ paleturquoise: 0xafeeeeff,
11096
+ palevioletred: 0xdb7093ff,
11097
+ papayawhip: 0xffefd5ff,
11098
+ peachpuff: 0xffdab9ff,
11099
+ peru: 0xcd853fff,
11100
+ pink: 0xffc0cbff,
11101
+ plum: 0xdda0ddff,
11102
+ powderblue: 0xb0e0e6ff,
11103
+ purple: 0x800080ff,
11104
+ rebeccapurple: 0x663399ff,
11105
+ red: 0xff0000ff,
11106
+ rosybrown: 0xbc8f8fff,
11107
+ royalblue: 0x4169e1ff,
11108
+ saddlebrown: 0x8b4513ff,
11109
+ salmon: 0xfa8072ff,
11110
+ sandybrown: 0xf4a460ff,
11111
+ seagreen: 0x2e8b57ff,
11112
+ seashell: 0xfff5eeff,
11113
+ sienna: 0xa0522dff,
11114
+ silver: 0xc0c0c0ff,
11115
+ skyblue: 0x87ceebff,
11116
+ slateblue: 0x6a5acdff,
11117
+ slategray: 0x708090ff,
11118
+ slategrey: 0x708090ff,
11119
+ snow: 0xfffafaff,
11120
+ springgreen: 0x00ff7fff,
11121
+ steelblue: 0x4682b4ff,
11122
+ tan: 0xd2b48cff,
11123
+ teal: 0x008080ff,
11124
+ thistle: 0xd8bfd8ff,
11125
+ tomato: 0xff6347ff,
11126
+ turquoise: 0x40e0d0ff,
11127
+ violet: 0xee82eeff,
11128
+ wheat: 0xf5deb3ff,
11129
+ white: 0xffffffff,
11130
+ whitesmoke: 0xf5f5f5ff,
11131
+ yellow: 0xffff00ff,
11132
+ yellowgreen: 0x9acd32ff
11133
+ };
11134
 
11135
+ const NUMBER = '[-+]?\\d*\\.?\\d+';
11136
+ const PERCENTAGE = NUMBER + '%';
 
 
 
 
11137
 
11138
+ function call(...parts) {
11139
+ return '\\(\\s*(' + parts.join(')\\s*,\\s*(') + ')\\s*\\)';
11140
+ }
11141
 
11142
+ const rgb = new RegExp('rgb' + call(NUMBER, NUMBER, NUMBER));
11143
+ const rgba = new RegExp('rgba' + call(NUMBER, NUMBER, NUMBER, NUMBER));
11144
+ const hsl = new RegExp('hsl' + call(NUMBER, PERCENTAGE, PERCENTAGE));
11145
+ const hsla = new RegExp('hsla' + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER));
11146
+ const hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
11147
+ const hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
11148
+ const hex6 = /^#([0-9a-fA-F]{6})$/;
11149
+ const hex8 = /^#([0-9a-fA-F]{8})$/;
11150
 
11151
+ function normalizeColor(color) {
11152
+ let match;
11153
 
11154
+ if (typeof color === 'number') {
11155
+ return color >>> 0 === color && color >= 0 && color <= 0xffffffff ? color : null;
11156
+ }
 
11157
 
11158
+ if (match = hex6.exec(color)) return parseInt(match[1] + 'ff', 16) >>> 0;
11159
 
11160
+ if (colors$1 && colors$1[color] !== undefined) {
11161
+ return colors$1[color];
11162
+ }
 
11163
 
11164
+ if (match = rgb.exec(color)) {
11165
+ return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | 0x000000ff) >>> 0;
11166
+ }
11167
 
11168
+ if (match = rgba.exec(color)) {
11169
+ return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | parse1(match[4])) >>> 0;
11170
+ }
11171
 
11172
+ if (match = hex3.exec(color)) {
11173
+ return parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + 'ff', 16) >>> 0;
11174
+ }
 
 
11175
 
11176
+ if (match = hex8.exec(color)) return parseInt(match[1], 16) >>> 0;
 
 
 
 
 
 
 
 
 
 
 
 
11177
 
11178
+ if (match = hex4.exec(color)) {
11179
+ return parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + match[4] + match[4], 16) >>> 0;
11180
+ }
11181
 
11182
+ if (match = hsl.exec(color)) {
11183
+ return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | 0x000000ff) >>> 0;
11184
+ }
11185
 
11186
+ if (match = hsla.exec(color)) {
11187
+ return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | parse1(match[4])) >>> 0;
11188
+ }
11189
 
11190
+ return null;
11191
+ }
11192
 
11193
+ function hue2rgb(p, q, t) {
11194
+ if (t < 0) t += 1;
11195
+ if (t > 1) t -= 1;
11196
+ if (t < 1 / 6) return p + (q - p) * 6 * t;
11197
+ if (t < 1 / 2) return q;
11198
+ if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
11199
+ return p;
11200
+ }
11201
 
11202
+ function hslToRgb(h, s, l) {
11203
+ const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
11204
+ const p = 2 * l - q;
11205
+ const r = hue2rgb(p, q, h + 1 / 3);
11206
+ const g = hue2rgb(p, q, h);
11207
+ const b = hue2rgb(p, q, h - 1 / 3);
11208
+ return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;
11209
+ }
11210
 
11211
+ function parse255(str) {
11212
+ const int = parseInt(str, 10);
11213
+ if (int < 0) return 0;
11214
+ if (int > 255) return 255;
11215
+ return int;
11216
+ }
11217
 
11218
+ function parse360(str) {
11219
+ const int = parseFloat(str);
11220
+ return (int % 360 + 360) % 360 / 360;
11221
+ }
11222
 
11223
+ function parse1(str) {
11224
+ const num = parseFloat(str);
11225
+ if (num < 0) return 0;
11226
+ if (num > 1) return 255;
11227
+ return Math.round(num * 255);
11228
+ }
11229
 
11230
+ function parsePercentage(str) {
11231
+ const int = parseFloat(str);
11232
+ if (int < 0) return 0;
11233
+ if (int > 100) return 1;
11234
+ return int / 100;
11235
+ }
11236
 
11237
+ function colorToRgba(input) {
11238
+ let int32Color = normalizeColor(input);
11239
+ if (int32Color === null) return input;
11240
+ int32Color = int32Color || 0;
11241
+ let r = (int32Color & 0xff000000) >>> 24;
11242
+ let g = (int32Color & 0x00ff0000) >>> 16;
11243
+ let b = (int32Color & 0x0000ff00) >>> 8;
11244
+ let a = (int32Color & 0x000000ff) / 255;
11245
+ return `rgba(${r}, ${g}, ${b}, ${a})`;
11246
+ }
11247
 
11248
+ const createInterpolator = (range, output, extrapolate) => {
11249
+ if (react_spring_shared_esm_is.fun(range)) {
11250
+ return range;
11251
+ }
11252
 
11253
+ if (react_spring_shared_esm_is.arr(range)) {
11254
+ return createInterpolator({
11255
+ range,
11256
+ output: output,
11257
+ extrapolate
11258
+ });
11259
+ }
 
11260
 
11261
+ if (react_spring_shared_esm_is.str(range.output[0])) {
11262
+ return createStringInterpolator$1(range);
11263
  }
11264
 
11265
+ const config = range;
11266
+ const outputRange = config.output;
11267
+ const inputRange = config.range || [0, 1];
11268
+ const extrapolateLeft = config.extrapolateLeft || config.extrapolate || 'extend';
11269
+ const extrapolateRight = config.extrapolateRight || config.extrapolate || 'extend';
 
 
 
 
 
 
 
 
 
 
 
11270
 
11271
+ const easing = config.easing || (t => t);
 
 
 
11272
 
11273
+ return input => {
11274
+ const range = findRange(input, inputRange);
11275
+ return interpolate(input, inputRange[range], inputRange[range + 1], outputRange[range], outputRange[range + 1], easing, extrapolateLeft, extrapolateRight, config.map);
11276
+ };
11277
+ };
11278
 
11279
+ function interpolate(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight, map) {
11280
+ let result = map ? map(input) : input;
11281
+
11282
+ if (result < inputMin) {
11283
+ if (extrapolateLeft === 'identity') return result;else if (extrapolateLeft === 'clamp') result = inputMin;
11284
  }
11285
 
11286
+ if (result > inputMax) {
11287
+ if (extrapolateRight === 'identity') return result;else if (extrapolateRight === 'clamp') result = inputMax;
11288
  }
11289
 
11290
+ if (outputMin === outputMax) return outputMin;
11291
+ if (inputMin === inputMax) return input <= inputMin ? outputMin : outputMax;
11292
+ if (inputMin === -Infinity) result = -result;else if (inputMax === Infinity) result = result - inputMin;else result = (result - inputMin) / (inputMax - inputMin);
11293
+ result = easing(result);
11294
+ if (outputMin === -Infinity) result = -result;else if (outputMax === Infinity) result = result + outputMin;else result = result * (outputMax - outputMin) + outputMin;
11295
+ return result;
11296
  }
 
 
 
 
 
 
 
11297
 
11298
+ function findRange(input, inputRange) {
11299
+ for (var i = 1; i < inputRange.length - 1; ++i) if (inputRange[i] >= input) break;
11300
+
11301
+ return i - 1;
11302
  }
 
 
 
 
 
11303
 
11304
+ function react_spring_shared_esm_extends() {
11305
+ react_spring_shared_esm_extends = Object.assign || function (target) {
11306
+ for (var i = 1; i < arguments.length; i++) {
11307
+ var source = arguments[i];
 
 
11308
 
11309
+ for (var key in source) {
11310
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
11311
+ target[key] = source[key];
11312
+ }
11313
+ }
11314
+ }
11315
 
11316
+ return target;
11317
+ };
11318
 
11319
+ return react_spring_shared_esm_extends.apply(this, arguments);
11320
+ }
 
11321
 
11322
+ const $get = Symbol.for('FluidValue.get');
11323
+ const $observers = Symbol.for('FluidValue.observers');
11324
 
11325
+ const hasFluidValue = arg => Boolean(arg && arg[$get]);
 
 
11326
 
11327
+ const getFluidValue = arg => arg && arg[$get] ? arg[$get]() : arg;
11328
 
11329
+ const getFluidObservers = target => target[$observers] || null;
11330
 
11331
+ function callFluidObserver(observer, event) {
11332
+ if (observer.eventObserved) {
11333
+ observer.eventObserved(event);
11334
+ } else {
11335
+ observer(event);
11336
+ }
11337
+ }
11338
 
11339
+ function callFluidObservers(target, event) {
11340
+ let observers = target[$observers];
11341
 
11342
+ if (observers) {
11343
+ observers.forEach(observer => {
11344
+ callFluidObserver(observer, event);
11345
+ });
11346
+ }
11347
+ }
11348
 
11349
+ class FluidValue {
11350
+ constructor(get) {
11351
+ this[$get] = void 0;
11352
+ this[$observers] = void 0;
11353
 
11354
+ if (!get && !(get = this.get)) {
11355
+ throw Error('Unknown getter');
11356
+ }
11357
 
11358
+ setFluidGetter(this, get);
11359
+ }
11360
 
11361
+ }
11362
 
11363
+ const setFluidGetter = (target, get) => setHidden(target, $get, get);
11364
 
11365
+ function addFluidObserver(target, observer) {
11366
+ if (target[$get]) {
11367
+ let observers = target[$observers];
11368
 
11369
+ if (!observers) {
11370
+ setHidden(target, $observers, observers = new Set());
 
 
 
 
 
 
 
 
 
 
 
 
11371
  }
11372
 
11373
+ if (!observers.has(observer)) {
11374
+ observers.add(observer);
11375
 
11376
+ if (target.observerAdded) {
11377
+ target.observerAdded(observers.size, observer);
11378
+ }
11379
+ }
11380
+ }
11381
+
11382
+ return observer;
11383
+ }
11384
+
11385
+ function removeFluidObserver(target, observer) {
11386
+ let observers = target[$observers];
11387
+
11388
+ if (observers && observers.has(observer)) {
11389
+ const count = observers.size - 1;
11390
+
11391
+ if (count) {
11392
+ observers.delete(observer);
11393
  } else {
11394
+ target[$observers] = null;
11395
+ }
11396
 
11397
+ if (target.observerRemoved) {
11398
+ target.observerRemoved(count, observer);
11399
  }
11400
+ }
11401
+ }
11402
 
11403
+ const setHidden = (target, key, value) => Object.defineProperty(target, key, {
11404
+ value,
11405
+ writable: true,
11406
+ configurable: true
11407
+ });
 
 
11408
 
11409
+ const numberRegex = /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;
11410
+ const colorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi;
11411
+ let namedColorRegex;
11412
+ const rgbaRegex = /rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi;
 
 
 
 
 
 
 
 
 
 
 
11413
 
11414
+ const rgbaRound = (_, p1, p2, p3, p4) => `rgba(${Math.round(p1)}, ${Math.round(p2)}, ${Math.round(p3)}, ${p4})`;
11415
+
11416
+ const createStringInterpolator = config => {
11417
+ if (!namedColorRegex) namedColorRegex = colors$1 ? new RegExp(`(${Object.keys(colors$1).join('|')})(?!\\w)`, 'g') : /^\b$/;
11418
+ const output = config.output.map(value => getFluidValue(value).replace(colorRegex, colorToRgba).replace(namedColorRegex, colorToRgba));
11419
+ const keyframes = output.map(value => value.match(numberRegex).map(Number));
11420
+ const outputRanges = keyframes[0].map((_, i) => keyframes.map(values => {
11421
+ if (!(i in values)) {
11422
+ throw Error('The arity of each "output" value must be equal');
11423
+ }
11424
+
11425
+ return values[i];
11426
  }));
11427
+ const interpolators = outputRanges.map(output => createInterpolator(react_spring_shared_esm_extends({}, config, {
11428
+ output
11429
+ })));
11430
+ return input => {
11431
+ let i = 0;
11432
+ return output[0].replace(numberRegex, () => String(interpolators[i++](input))).replace(rgbaRegex, rgbaRound);
11433
+ };
 
 
 
11434
  };
11435
 
11436
+ const prefix = 'react-spring: ';
 
 
 
 
 
 
 
11437
 
11438
+ const once = fn => {
11439
+ const func = fn;
11440
+ let called = false;
11441
+
11442
+ if (typeof func != 'function') {
11443
+ throw new TypeError(`${prefix}once requires a function parameter`);
11444
  }
11445
 
11446
+ return (...args) => {
11447
+ if (!called) {
11448
+ func(...args);
11449
+ called = true;
11450
+ }
11451
+ };
11452
  };
11453
 
11454
+ const warnInterpolate = once(console.warn);
11455
+ function react_spring_shared_esm_deprecateInterpolate() {
11456
+ warnInterpolate(`${prefix}The "interpolate" function is deprecated in v9 (use "to" instead)`);
11457
+ }
11458
+ const warnDirectCall = once(console.warn);
11459
+ function deprecateDirectCall() {
11460
+ warnDirectCall(`${prefix}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`);
11461
+ }
 
11462
 
11463
+ function isAnimatedString(value) {
11464
+ return react_spring_shared_esm_is.str(value) && (value[0] == '#' || /\d/.test(value) || value in (colors$1 || {}));
11465
+ }
11466
 
11467
+ const react_spring_shared_esm_useOnce = effect => (0,external_React_.useEffect)(effect, emptyDeps);
11468
+ const emptyDeps = [];
 
11469
 
11470
+ function react_spring_shared_esm_useForceUpdate() {
11471
+ const update = (0,external_React_.useState)()[1];
11472
+ const mounted = (0,external_React_.useState)(makeMountedRef)[0];
11473
+ react_spring_shared_esm_useOnce(mounted.unmount);
11474
+ return () => {
11475
+ if (mounted.current) {
11476
+ update({});
11477
+ }
11478
+ };
11479
+ }
11480
 
11481
+ function makeMountedRef() {
11482
+ const mounted = {
11483
+ current: true,
11484
+ unmount: () => () => {
11485
+ mounted.current = false;
11486
+ }
11487
+ };
11488
+ return mounted;
11489
+ }
11490
 
11491
+ function useMemoOne(getResult, inputs) {
11492
+ const [initial] = (0,external_React_.useState)(() => ({
11493
+ inputs,
11494
+ result: getResult()
11495
+ }));
11496
+ const committed = (0,external_React_.useRef)();
11497
+ const prevCache = committed.current;
11498
+ let cache = prevCache;
11499
 
11500
+ if (cache) {
11501
+ const useCache = Boolean(inputs && cache.inputs && areInputsEqual(inputs, cache.inputs));
11502
 
11503
+ if (!useCache) {
11504
+ cache = {
11505
+ inputs,
11506
+ result: getResult()
11507
+ };
11508
+ }
11509
+ } else {
11510
+ cache = initial;
11511
+ }
11512
 
11513
+ (0,external_React_.useEffect)(() => {
11514
+ committed.current = cache;
 
 
 
 
 
 
 
 
11515
 
11516
+ if (prevCache == initial) {
11517
+ initial.inputs = initial.result = undefined;
11518
+ }
11519
+ }, [cache]);
11520
+ return cache.result;
 
 
 
 
 
11521
  }
11522
 
11523
+ function areInputsEqual(next, prev) {
11524
+ if (next.length !== prev.length) {
11525
+ return false;
 
 
 
 
 
 
 
 
11526
  }
11527
 
11528
+ for (let i = 0; i < next.length; i++) {
11529
+ if (next[i] !== prev[i]) {
11530
+ return false;
11531
+ }
 
 
 
 
 
11532
  }
11533
 
11534
+ return true;
11535
+ }
11536
+
11537
+ function react_spring_shared_esm_usePrev(value) {
11538
+ const prevRef = (0,external_React_.useRef)();
11539
+ (0,external_React_.useEffect)(() => {
11540
+ prevRef.current = value;
11541
  });
11542
+ return prevRef.current;
11543
  }
11544
 
11545
+ const react_spring_shared_esm_useLayoutEffect = typeof window !== 'undefined' && window.document && window.document.createElement ? external_React_.useLayoutEffect : external_React_.useEffect;
 
 
11546
 
11547
 
 
 
 
11548
 
11549
+ ;// CONCATENATED MODULE: ./node_modules/@react-spring/animated/dist/react-spring-animated.esm.js
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11550
 
11551
 
 
 
 
11552
 
11553
 
11554
+ const $node = Symbol.for('Animated:node');
11555
+ const isAnimated = value => !!value && value[$node] === value;
11556
+ const getAnimated = owner => owner && owner[$node];
11557
+ const setAnimated = (owner, node) => defineHidden(owner, $node, node);
11558
+ const getPayload = owner => owner && owner[$node] && owner[$node].getPayload();
11559
+ class Animated {
11560
+ constructor() {
11561
+ this.payload = void 0;
11562
+ setAnimated(this, this);
11563
+ }
11564
 
11565
+ getPayload() {
11566
+ return this.payload || [];
11567
+ }
11568
 
11569
+ }
 
 
 
 
 
 
11570
 
11571
+ class AnimatedValue extends Animated {
11572
+ constructor(_value) {
11573
+ super();
11574
+ this.done = true;
11575
+ this.elapsedTime = void 0;
11576
+ this.lastPosition = void 0;
11577
+ this.lastVelocity = void 0;
11578
+ this.v0 = void 0;
11579
+ this.durationProgress = 0;
11580
+ this._value = _value;
 
 
 
 
 
11581
 
11582
+ if (react_spring_shared_esm_is.num(this._value)) {
11583
+ this.lastPosition = this._value;
11584
+ }
11585
+ }
 
 
 
 
 
 
 
 
 
 
 
11586
 
11587
+ static create(value) {
11588
+ return new AnimatedValue(value);
11589
+ }
 
 
 
 
11590
 
11591
+ getPayload() {
11592
+ return [this];
11593
+ }
 
11594
 
11595
+ getValue() {
11596
+ return this._value;
11597
+ }
11598
+
11599
+ setValue(value, step) {
11600
+ if (react_spring_shared_esm_is.num(value)) {
11601
+ this.lastPosition = value;
11602
+
11603
+ if (step) {
11604
+ value = Math.round(value / step) * step;
11605
+
11606
+ if (this.done) {
11607
+ this.lastPosition = value;
11608
  }
11609
  }
11610
+ }
11611
 
11612
+ if (this._value === value) {
11613
+ return false;
11614
  }
11615
 
11616
+ this._value = value;
11617
+ return true;
11618
+ }
 
 
 
 
 
 
 
11619
 
11620
+ reset() {
11621
+ const {
11622
+ done
11623
+ } = this;
11624
+ this.done = false;
11625
 
11626
+ if (react_spring_shared_esm_is.num(this._value)) {
11627
+ this.elapsedTime = 0;
11628
+ this.durationProgress = 0;
11629
+ this.lastPosition = this._value;
11630
+ if (done) this.lastVelocity = null;
11631
+ this.v0 = null;
 
 
 
11632
  }
11633
+ }
11634
 
 
 
 
 
 
 
11635
  }
11636
 
11637
+ class AnimatedString extends AnimatedValue {
11638
+ constructor(value) {
11639
+ super(0);
11640
+ this._string = null;
11641
+ this._toString = void 0;
11642
+ this._toString = createInterpolator({
11643
+ output: [value, value]
11644
+ });
11645
+ }
11646
 
11647
+ static create(value) {
11648
+ return new AnimatedString(value);
11649
+ }
11650
 
11651
+ getValue() {
11652
+ let value = this._string;
11653
+ return value == null ? this._string = this._toString(this._value) : value;
11654
+ }
 
 
 
11655
 
11656
+ setValue(value) {
11657
+ if (react_spring_shared_esm_is.str(value)) {
11658
+ if (value == this._string) {
11659
+ return false;
11660
+ }
11661
 
11662
+ this._string = value;
11663
+ this._value = 1;
11664
+ } else if (super.setValue(value)) {
11665
+ this._string = null;
11666
+ } else {
11667
+ return false;
11668
+ }
11669
 
11670
+ return true;
11671
+ }
11672
 
11673
+ reset(goal) {
11674
+ if (goal) {
11675
+ this._toString = createInterpolator({
11676
+ output: [this.getValue(), goal]
11677
+ });
11678
+ }
11679
 
11680
+ this._value = 0;
11681
+ super.reset();
11682
+ }
11683
 
11684
+ }
11685
 
11686
+ const TreeContext = {
11687
+ dependencies: null
11688
+ };
11689
 
11690
+ class AnimatedObject extends Animated {
11691
+ constructor(source) {
11692
+ super();
11693
+ this.source = source;
11694
+ this.setValue(source);
11695
+ }
11696
 
11697
+ getValue(animated) {
11698
+ const values = {};
11699
+ eachProp(this.source, (source, key) => {
11700
+ if (isAnimated(source)) {
11701
+ values[key] = source.getValue(animated);
11702
+ } else if (hasFluidValue(source)) {
11703
+ values[key] = getFluidValue(source);
11704
+ } else if (!animated) {
11705
+ values[key] = source;
11706
+ }
11707
+ });
11708
+ return values;
11709
+ }
11710
+
11711
+ setValue(source) {
11712
+ this.source = source;
11713
+ this.payload = this._makePayload(source);
11714
+ }
11715
+
11716
+ reset() {
11717
+ if (this.payload) {
11718
+ react_spring_shared_esm_each(this.payload, node => node.reset());
11719
  }
11720
+ }
11721
 
11722
+ _makePayload(source) {
11723
+ if (source) {
11724
+ const payload = new Set();
11725
+ eachProp(source, this._addToPayload, payload);
11726
+ return Array.from(payload);
11727
  }
11728
+ }
11729
 
11730
+ _addToPayload(source) {
11731
+ if (TreeContext.dependencies && hasFluidValue(source)) {
11732
+ TreeContext.dependencies.add(source);
11733
+ }
11734
 
11735
+ const payload = getPayload(source);
11736
+
11737
+ if (payload) {
11738
+ react_spring_shared_esm_each(payload, node => this.add(node));
11739
  }
11740
+ }
11741
 
 
 
 
 
 
 
 
 
 
 
 
11742
  }
 
 
11743
 
11744
+ class AnimatedArray extends AnimatedObject {
11745
+ constructor(source) {
11746
+ super(source);
11747
+ }
11748
 
11749
+ static create(source) {
11750
+ return new AnimatedArray(source);
11751
+ }
11752
 
11753
+ getValue() {
11754
+ return this.source.map(node => node.getValue());
11755
+ }
11756
 
11757
+ setValue(source) {
11758
+ const payload = this.getPayload();
11759
 
11760
+ if (source.length == payload.length) {
11761
+ return payload.map((node, i) => node.setValue(source[i])).some(Boolean);
11762
+ }
11763
 
11764
+ super.setValue(source.map(makeAnimated));
11765
+ return true;
11766
+ }
11767
+
11768
+ }
11769
 
11770
+ function makeAnimated(value) {
11771
+ const nodeType = isAnimatedString(value) ? AnimatedString : AnimatedValue;
11772
+ return nodeType.create(value);
11773
+ }
11774
 
11775
+ function getAnimatedType(value) {
11776
+ const parentNode = getAnimated(value);
11777
+ return parentNode ? parentNode.constructor : react_spring_shared_esm_is.arr(value) ? AnimatedArray : isAnimatedString(value) ? AnimatedString : AnimatedValue;
11778
+ }
11779
 
11780
+ function react_spring_animated_esm_extends() {
11781
+ react_spring_animated_esm_extends = Object.assign || function (target) {
11782
+ for (var i = 1; i < arguments.length; i++) {
11783
+ var source = arguments[i];
11784
 
11785
+ for (var key in source) {
11786
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
11787
+ target[key] = source[key];
11788
+ }
11789
+ }
11790
+ }
11791
 
11792
+ return target;
11793
+ };
 
11794
 
11795
+ return react_spring_animated_esm_extends.apply(this, arguments);
11796
+ }
11797
 
11798
+ const withAnimated = (Component, host) => {
11799
+ const hasInstance = !react_spring_shared_esm_is.fun(Component) || Component.prototype && Component.prototype.isReactComponent;
11800
+ return (0,external_React_.forwardRef)((givenProps, givenRef) => {
11801
+ const instanceRef = (0,external_React_.useRef)(null);
11802
+ const ref = hasInstance && (0,external_React_.useCallback)(value => {
11803
+ instanceRef.current = updateRef(givenRef, value);
11804
+ }, [givenRef]);
11805
+ const [props, deps] = getAnimatedState(givenProps, host);
11806
+ const forceUpdate = react_spring_shared_esm_useForceUpdate();
11807
 
11808
+ const callback = () => {
11809
+ const instance = instanceRef.current;
11810
 
11811
+ if (hasInstance && !instance) {
11812
+ return;
11813
+ }
11814
 
11815
+ const didUpdate = instance ? host.applyAnimatedValues(instance, props.getValue(true)) : false;
11816
 
11817
+ if (didUpdate === false) {
11818
+ forceUpdate();
11819
+ }
11820
+ };
11821
 
11822
+ const observer = new PropsObserver(callback, deps);
11823
+ const observerRef = (0,external_React_.useRef)();
11824
+ react_spring_shared_esm_useLayoutEffect(() => {
11825
+ const lastObserver = observerRef.current;
11826
+ observerRef.current = observer;
11827
+ react_spring_shared_esm_each(deps, dep => addFluidObserver(dep, observer));
11828
 
11829
+ if (lastObserver) {
11830
+ react_spring_shared_esm_each(lastObserver.deps, dep => removeFluidObserver(dep, lastObserver));
11831
+ raf.cancel(lastObserver.update);
11832
+ }
11833
+ });
11834
+ (0,external_React_.useEffect)(callback, []);
11835
+ react_spring_shared_esm_useOnce(() => () => {
11836
+ const observer = observerRef.current;
11837
+ react_spring_shared_esm_each(observer.deps, dep => removeFluidObserver(dep, observer));
11838
+ });
11839
+ const usedProps = host.getComponentProps(props.getValue());
11840
+ return external_React_.createElement(Component, react_spring_animated_esm_extends({}, usedProps, {
11841
+ ref: ref
11842
+ }));
11843
+ });
11844
  };
11845
 
11846
+ class PropsObserver {
11847
+ constructor(update, deps) {
11848
+ this.update = update;
11849
+ this.deps = deps;
11850
  }
11851
 
11852
+ eventObserved(event) {
11853
+ if (event.type == 'change') {
11854
+ raf.write(this.update);
11855
+ }
11856
+ }
11857
 
11858
+ }
 
 
 
11859
 
11860
+ function getAnimatedState(props, host) {
11861
+ const dependencies = new Set();
11862
+ TreeContext.dependencies = dependencies;
11863
+ if (props.style) props = react_spring_animated_esm_extends({}, props, {
11864
+ style: host.createAnimatedStyle(props.style)
11865
+ });
11866
+ props = new AnimatedObject(props);
11867
+ TreeContext.dependencies = null;
11868
+ return [props, dependencies];
11869
+ }
11870
 
11871
+ function updateRef(ref, value) {
11872
+ if (ref) {
11873
+ if (react_spring_shared_esm_is.fun(ref)) ref(value);else ref.current = value;
11874
+ }
 
 
 
 
 
 
 
 
11875
 
11876
+ return value;
11877
+ }
11878
 
11879
+ const cacheKey = Symbol.for('AnimatedComponent');
11880
+ const createHost = (components, {
11881
+ applyAnimatedValues: _applyAnimatedValues = () => false,
11882
+ createAnimatedStyle: _createAnimatedStyle = style => new AnimatedObject(style),
11883
+ getComponentProps: _getComponentProps = props => props
11884
+ } = {}) => {
11885
+ const hostConfig = {
11886
+ applyAnimatedValues: _applyAnimatedValues,
11887
+ createAnimatedStyle: _createAnimatedStyle,
11888
+ getComponentProps: _getComponentProps
11889
+ };
11890
 
11891
+ const animated = Component => {
11892
+ const displayName = getDisplayName(Component) || 'Anonymous';
11893
 
11894
+ if (react_spring_shared_esm_is.str(Component)) {
11895
+ Component = animated[Component] || (animated[Component] = withAnimated(Component, hostConfig));
11896
+ } else {
11897
+ Component = Component[cacheKey] || (Component[cacheKey] = withAnimated(Component, hostConfig));
11898
+ }
 
 
11899
 
11900
+ Component.displayName = `Animated(${displayName})`;
11901
+ return Component;
11902
+ };
 
 
 
 
11903
 
11904
+ eachProp(components, (Component, key) => {
11905
+ if (react_spring_shared_esm_is.arr(components)) {
11906
+ key = getDisplayName(Component);
11907
+ }
 
 
 
11908
 
11909
+ animated[key] = animated(Component);
11910
+ });
11911
+ return {
11912
+ animated
11913
+ };
11914
+ };
 
 
 
 
 
11915
 
11916
+ const getDisplayName = arg => react_spring_shared_esm_is.str(arg) ? arg : arg && react_spring_shared_esm_is.str(arg.displayName) ? arg.displayName : react_spring_shared_esm_is.fun(arg) && arg.name || null;
11917
 
 
 
11918
 
 
 
 
11919
 
11920
+ ;// CONCATENATED MODULE: ./node_modules/@react-spring/core/dist/react-spring-core.esm.js
11921
 
 
 
 
 
 
 
 
11922
 
 
11923
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11924
 
 
 
 
 
11925
 
 
11926
 
 
 
11927
 
11928
+
11929
+ function react_spring_core_esm_extends() {
11930
+ react_spring_core_esm_extends = Object.assign || function (target) {
11931
+ for (var i = 1; i < arguments.length; i++) {
11932
+ var source = arguments[i];
11933
+
11934
+ for (var key in source) {
11935
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
11936
+ target[key] = source[key];
11937
+ }
11938
+ }
11939
  }
11940
 
11941
+ return target;
11942
  };
11943
 
11944
+ return react_spring_core_esm_extends.apply(this, arguments);
11945
  }
11946
 
11947
+ function callProp(value, ...args) {
11948
+ return react_spring_shared_esm_is.fun(value) ? value(...args) : value;
11949
+ }
11950
+ const matchProp = (value, key) => value === true || !!(key && value && (react_spring_shared_esm_is.fun(value) ? value(key) : react_spring_shared_esm_toArray(value).includes(key)));
11951
+ const resolveProp = (prop, key) => react_spring_shared_esm_is.obj(prop) ? key && prop[key] : prop;
11952
+ const getDefaultProp = (props, key) => props.default === true ? props[key] : props.default ? props.default[key] : undefined;
11953
 
11954
+ const noopTransform = value => value;
 
 
11955
 
11956
+ const getDefaultProps = (props, transform = noopTransform) => {
11957
+ let keys = DEFAULT_PROPS;
11958
 
11959
+ if (props.default && props.default !== true) {
11960
+ props = props.default;
11961
+ keys = Object.keys(props);
11962
+ }
 
 
 
 
 
 
11963
 
11964
+ const defaults = {};
11965
 
11966
+ for (const key of keys) {
11967
+ const value = transform(props[key], key);
11968
 
11969
+ if (!react_spring_shared_esm_is.und(value)) {
11970
+ defaults[key] = value;
11971
+ }
11972
+ }
 
 
 
 
 
 
 
 
 
 
11973
 
11974
+ return defaults;
11975
+ };
11976
+ const DEFAULT_PROPS = ['config', 'onProps', 'onStart', 'onChange', 'onPause', 'onResume', 'onRest'];
11977
+ const RESERVED_PROPS = {
11978
+ config: 1,
11979
+ from: 1,
11980
+ to: 1,
11981
+ ref: 1,
11982
+ loop: 1,
11983
+ reset: 1,
11984
+ pause: 1,
11985
+ cancel: 1,
11986
+ reverse: 1,
11987
+ immediate: 1,
11988
+ default: 1,
11989
+ delay: 1,
11990
+ onProps: 1,
11991
+ onStart: 1,
11992
+ onChange: 1,
11993
+ onPause: 1,
11994
+ onResume: 1,
11995
+ onRest: 1,
11996
+ onResolve: 1,
11997
+ items: 1,
11998
+ trail: 1,
11999
+ sort: 1,
12000
+ expires: 1,
12001
+ initial: 1,
12002
+ enter: 1,
12003
+ update: 1,
12004
+ leave: 1,
12005
+ children: 1,
12006
+ onDestroyed: 1,
12007
+ keys: 1,
12008
+ callId: 1,
12009
+ parentId: 1
12010
+ };
12011
 
12012
+ function getForwardProps(props) {
12013
+ const forward = {};
12014
+ let count = 0;
12015
+ eachProp(props, (value, prop) => {
12016
+ if (!RESERVED_PROPS[prop]) {
12017
+ forward[prop] = value;
12018
+ count++;
12019
+ }
12020
+ });
12021
+
12022
+ if (count) {
12023
+ return forward;
12024
  }
12025
+ }
12026
 
12027
+ function inferTo(props) {
12028
+ const to = getForwardProps(props);
 
 
12029
 
12030
+ if (to) {
12031
+ const out = {
12032
+ to
12033
+ };
12034
+ eachProp(props, (val, key) => key in to || (out[key] = val));
12035
+ return out;
12036
  }
12037
 
12038
+ return react_spring_core_esm_extends({}, props);
12039
+ }
12040
+ function computeGoal(value) {
12041
+ value = getFluidValue(value);
12042
+ return react_spring_shared_esm_is.arr(value) ? value.map(computeGoal) : isAnimatedString(value) ? globals.createStringInterpolator({
12043
+ range: [0, 1],
12044
+ output: [value, value]
12045
+ })(1) : value;
12046
+ }
12047
+ function hasProps(props) {
12048
+ for (const _ in props) return true;
12049
 
12050
+ return false;
12051
+ }
12052
+ function isAsyncTo(to) {
12053
+ return react_spring_shared_esm_is.fun(to) || react_spring_shared_esm_is.arr(to) && react_spring_shared_esm_is.obj(to[0]);
12054
+ }
12055
+ function detachRefs(ctrl, ref) {
12056
+ var _ctrl$ref;
12057
 
12058
+ (_ctrl$ref = ctrl.ref) == null ? void 0 : _ctrl$ref.delete(ctrl);
12059
+ ref == null ? void 0 : ref.delete(ctrl);
12060
+ }
12061
+ function replaceRef(ctrl, ref) {
12062
+ if (ref && ctrl.ref !== ref) {
12063
+ var _ctrl$ref2;
12064
 
12065
+ (_ctrl$ref2 = ctrl.ref) == null ? void 0 : _ctrl$ref2.delete(ctrl);
12066
+ ref.add(ctrl);
12067
+ ctrl.ref = ref;
12068
+ }
12069
+ }
12070
 
12071
+ function useChain(refs, timeSteps, timeFrame = 1000) {
12072
+ useLayoutEffect(() => {
12073
+ if (timeSteps) {
12074
+ let prevDelay = 0;
12075
+ each(refs, (ref, i) => {
12076
+ const controllers = ref.current;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12077
 
12078
+ if (controllers.length) {
12079
+ let delay = timeFrame * timeSteps[i];
12080
+ if (isNaN(delay)) delay = prevDelay;else prevDelay = delay;
12081
+ each(controllers, ctrl => {
12082
+ each(ctrl.queue, props => {
12083
+ const memoizedDelayProp = props.delay;
12084
 
12085
+ props.delay = key => delay + callProp(memoizedDelayProp || 0, key);
12086
+ });
12087
+ ctrl.start();
12088
+ });
12089
  }
12090
+ });
 
 
 
 
12091
  } else {
12092
+ let p = Promise.resolve();
12093
+ each(refs, ref => {
12094
+ const controllers = ref.current;
12095
 
12096
+ if (controllers.length) {
12097
+ const queues = controllers.map(ctrl => {
12098
+ const q = ctrl.queue;
12099
+ ctrl.queue = [];
12100
+ return q;
12101
+ });
12102
+ p = p.then(() => {
12103
+ each(controllers, (ctrl, i) => each(queues[i] || [], update => ctrl.queue.push(update)));
12104
+ return ref.start();
12105
+ });
12106
  }
12107
+ });
 
 
 
 
12108
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12109
  });
12110
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12111
 
12112
+ const config = {
12113
+ default: {
12114
+ tension: 170,
12115
+ friction: 26
12116
+ },
12117
+ gentle: {
12118
+ tension: 120,
12119
+ friction: 14
12120
+ },
12121
+ wobbly: {
12122
+ tension: 180,
12123
+ friction: 12
12124
+ },
12125
+ stiff: {
12126
+ tension: 210,
12127
+ friction: 20
12128
+ },
12129
+ slow: {
12130
+ tension: 280,
12131
+ friction: 60
12132
+ },
12133
+ molasses: {
12134
+ tension: 280,
12135
+ friction: 120
12136
  }
12137
+ };
12138
 
12139
+ const linear = t => t;
12140
+
12141
+ const defaults = react_spring_core_esm_extends({}, config.default, {
12142
+ mass: 1,
12143
+ damping: 1,
12144
+ easing: linear,
12145
+ clamp: false
 
 
 
 
 
 
12146
  });
 
 
 
 
 
 
12147
 
12148
+ class AnimationConfig {
12149
+ constructor() {
12150
+ this.tension = void 0;
12151
+ this.friction = void 0;
12152
+ this.frequency = void 0;
12153
+ this.damping = void 0;
12154
+ this.mass = void 0;
12155
+ this.velocity = 0;
12156
+ this.restVelocity = void 0;
12157
+ this.precision = void 0;
12158
+ this.progress = void 0;
12159
+ this.duration = void 0;
12160
+ this.easing = void 0;
12161
+ this.clamp = void 0;
12162
+ this.bounce = void 0;
12163
+ this.decay = void 0;
12164
+ this.round = void 0;
12165
+ Object.assign(this, defaults);
12166
+ }
12167
 
12168
+ }
12169
+ function mergeConfig(config, newConfig, defaultConfig) {
12170
+ if (defaultConfig) {
12171
+ defaultConfig = react_spring_core_esm_extends({}, defaultConfig);
12172
+ sanitizeConfig(defaultConfig, newConfig);
12173
+ newConfig = react_spring_core_esm_extends({}, defaultConfig, newConfig);
12174
+ }
12175
 
12176
+ sanitizeConfig(config, newConfig);
12177
+ Object.assign(config, newConfig);
 
 
 
 
 
 
 
12178
 
12179
+ for (const key in defaults) {
12180
+ if (config[key] == null) {
12181
+ config[key] = defaults[key];
12182
+ }
12183
+ }
12184
 
12185
+ let {
12186
+ mass,
12187
+ frequency,
12188
+ damping
12189
+ } = config;
12190
 
12191
+ if (!react_spring_shared_esm_is.und(frequency)) {
12192
+ if (frequency < 0.01) frequency = 0.01;
12193
+ if (damping < 0) damping = 0;
12194
+ config.tension = Math.pow(2 * Math.PI / frequency, 2) * mass;
12195
+ config.friction = 4 * Math.PI * damping * mass / frequency;
12196
+ }
 
 
 
12197
 
12198
+ return config;
12199
+ }
12200
 
12201
+ function sanitizeConfig(config, props) {
12202
+ if (!react_spring_shared_esm_is.und(props.decay)) {
12203
+ config.duration = undefined;
12204
+ } else {
12205
+ const isTensionConfig = !react_spring_shared_esm_is.und(props.tension) || !react_spring_shared_esm_is.und(props.friction);
12206
 
12207
+ if (isTensionConfig || !react_spring_shared_esm_is.und(props.frequency) || !react_spring_shared_esm_is.und(props.damping) || !react_spring_shared_esm_is.und(props.mass)) {
12208
+ config.duration = undefined;
12209
+ config.decay = undefined;
12210
+ }
12211
 
12212
+ if (isTensionConfig) {
12213
+ config.frequency = undefined;
12214
+ }
12215
+ }
12216
+ }
12217
 
12218
+ const emptyArray = [];
12219
+ class Animation {
12220
+ constructor() {
12221
+ this.changed = false;
12222
+ this.values = emptyArray;
12223
+ this.toValues = null;
12224
+ this.fromValues = emptyArray;
12225
+ this.to = void 0;
12226
+ this.from = void 0;
12227
+ this.config = new AnimationConfig();
12228
+ this.immediate = false;
12229
+ }
 
 
 
 
 
 
12230
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12231
  }
 
 
12232
 
12233
+ function scheduleProps(callId, {
12234
+ key,
12235
+ props,
12236
+ defaultProps,
12237
+ state,
12238
+ actions
12239
+ }) {
12240
+ return new Promise((resolve, reject) => {
12241
+ var _props$cancel;
12242
 
12243
+ let delay;
12244
+ let timeout;
12245
+ let cancel = matchProp((_props$cancel = props.cancel) != null ? _props$cancel : defaultProps == null ? void 0 : defaultProps.cancel, key);
 
 
 
 
12246
 
12247
+ if (cancel) {
12248
+ onStart();
12249
+ } else {
12250
+ if (!react_spring_shared_esm_is.und(props.pause)) {
12251
+ state.paused = matchProp(props.pause, key);
12252
+ }
12253
 
12254
+ let pause = defaultProps == null ? void 0 : defaultProps.pause;
12255
 
12256
+ if (pause !== true) {
12257
+ pause = state.paused || matchProp(pause, key);
12258
+ }
12259
 
12260
+ delay = callProp(props.delay || 0, key);
 
 
 
12261
 
12262
+ if (pause) {
12263
+ state.resumeQueue.add(onResume);
12264
+ actions.pause();
12265
+ } else {
12266
+ actions.resume();
12267
+ onResume();
12268
+ }
12269
+ }
12270
 
12271
+ function onPause() {
12272
+ state.resumeQueue.add(onResume);
12273
+ state.timeouts.delete(timeout);
12274
+ timeout.cancel();
12275
+ delay = timeout.time - raf.now();
12276
+ }
12277
 
12278
+ function onResume() {
12279
+ if (delay > 0) {
12280
+ timeout = raf.setTimeout(onStart, delay);
12281
+ state.pauseQueue.add(onPause);
12282
+ state.timeouts.add(timeout);
12283
+ } else {
12284
+ onStart();
12285
+ }
12286
+ }
12287
 
12288
+ function onStart() {
12289
+ state.pauseQueue.delete(onPause);
12290
+ state.timeouts.delete(timeout);
12291
 
12292
+ if (callId <= (state.cancelId || 0)) {
12293
+ cancel = true;
12294
+ }
 
 
 
 
 
 
12295
 
12296
+ try {
12297
+ actions.start(react_spring_core_esm_extends({}, props, {
12298
+ callId,
12299
+ cancel
12300
+ }), resolve);
12301
+ } catch (err) {
12302
+ reject(err);
12303
+ }
12304
+ }
12305
  });
12306
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12307
 
12308
+ const getCombinedResult = (target, results) => results.length == 1 ? results[0] : results.some(result => result.cancelled) ? getCancelledResult(target.get()) : results.every(result => result.noop) ? getNoopResult(target.get()) : getFinishedResult(target.get(), results.every(result => result.finished));
12309
+ const getNoopResult = value => ({
12310
+ value,
12311
+ noop: true,
12312
+ finished: true,
12313
+ cancelled: false
12314
+ });
12315
+ const getFinishedResult = (value, finished, cancelled = false) => ({
12316
+ value,
12317
+ finished,
12318
+ cancelled
12319
+ });
12320
+ const getCancelledResult = value => ({
12321
+ value,
12322
+ cancelled: true,
12323
+ finished: false
12324
+ });
12325
 
12326
+ function runAsync(to, props, state, target) {
12327
+ const {
12328
+ callId,
12329
+ parentId,
12330
+ onRest
12331
+ } = props;
12332
+ const {
12333
+ asyncTo: prevTo,
12334
+ promise: prevPromise
12335
+ } = state;
12336
 
12337
+ if (!parentId && to === prevTo && !props.reset) {
12338
+ return prevPromise;
12339
+ }
12340
 
12341
+ return state.promise = (async () => {
12342
+ state.asyncId = callId;
12343
+ state.asyncTo = to;
12344
+ const defaultProps = getDefaultProps(props, (value, key) => key === 'onRest' ? undefined : value);
12345
+ let preventBail;
12346
+ let bail;
12347
+ const bailPromise = new Promise((resolve, reject) => (preventBail = resolve, bail = reject));
12348
 
12349
+ const bailIfEnded = bailSignal => {
12350
+ const bailResult = callId <= (state.cancelId || 0) && getCancelledResult(target) || callId !== state.asyncId && getFinishedResult(target, false);
 
 
 
 
 
 
 
12351
 
12352
+ if (bailResult) {
12353
+ bailSignal.result = bailResult;
12354
+ bail(bailSignal);
12355
+ throw bailSignal;
12356
+ }
12357
+ };
12358
 
12359
+ const animate = (arg1, arg2) => {
12360
+ const bailSignal = new BailSignal();
12361
+ const skipAnimationSignal = new SkipAniamtionSignal();
12362
+ return (async () => {
12363
+ if (globals.skipAnimation) {
12364
+ stopAsync(state);
12365
+ skipAnimationSignal.result = getFinishedResult(target, false);
12366
+ bail(skipAnimationSignal);
12367
+ throw skipAnimationSignal;
12368
+ }
12369
 
12370
+ bailIfEnded(bailSignal);
12371
+ const props = react_spring_shared_esm_is.obj(arg1) ? react_spring_core_esm_extends({}, arg1) : react_spring_core_esm_extends({}, arg2, {
12372
+ to: arg1
12373
+ });
12374
+ props.parentId = callId;
12375
+ eachProp(defaultProps, (value, key) => {
12376
+ if (react_spring_shared_esm_is.und(props[key])) {
12377
+ props[key] = value;
12378
+ }
12379
+ });
12380
+ const result = await target.start(props);
12381
+ bailIfEnded(bailSignal);
12382
 
12383
+ if (state.paused) {
12384
+ await new Promise(resume => {
12385
+ state.resumeQueue.add(resume);
12386
+ });
12387
+ }
12388
 
12389
+ return result;
12390
+ })();
12391
+ };
12392
 
12393
+ let result;
12394
 
12395
+ if (globals.skipAnimation) {
12396
+ stopAsync(state);
12397
+ return getFinishedResult(target, false);
12398
+ }
12399
 
12400
+ try {
12401
+ let animating;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12402
 
12403
+ if (react_spring_shared_esm_is.arr(to)) {
12404
+ animating = (async queue => {
12405
+ for (const props of queue) {
12406
+ await animate(props);
12407
+ }
12408
+ })(to);
12409
+ } else {
12410
+ animating = Promise.resolve(to(animate, target.stop.bind(target)));
12411
+ }
 
 
 
 
 
 
 
 
 
 
 
 
12412
 
12413
+ await Promise.all([animating.then(preventBail), bailPromise]);
12414
+ result = getFinishedResult(target.get(), true, false);
12415
+ } catch (err) {
12416
+ if (err instanceof BailSignal) {
12417
+ result = err.result;
12418
+ } else if (err instanceof SkipAniamtionSignal) {
12419
+ result = err.result;
12420
+ } else {
12421
+ throw err;
12422
+ }
12423
+ } finally {
12424
+ if (callId == state.asyncId) {
12425
+ state.asyncId = parentId;
12426
+ state.asyncTo = parentId ? prevTo : undefined;
12427
+ state.promise = parentId ? prevPromise : undefined;
12428
+ }
12429
+ }
12430
 
12431
+ if (react_spring_shared_esm_is.fun(onRest)) {
12432
+ raf.batchedUpdates(() => {
12433
+ onRest(result, target, target.item);
12434
+ });
12435
+ }
12436
 
12437
+ return result;
12438
+ })();
12439
+ }
12440
+ function stopAsync(state, cancelId) {
12441
+ flush(state.timeouts, t => t.cancel());
12442
+ state.pauseQueue.clear();
12443
+ state.resumeQueue.clear();
12444
+ state.asyncId = state.asyncTo = state.promise = undefined;
12445
+ if (cancelId) state.cancelId = cancelId;
12446
+ }
12447
+ class BailSignal extends Error {
12448
+ constructor() {
12449
+ super('An async animation has been interrupted. You see this error because you ' + 'forgot to use `await` or `.catch(...)` on its returned promise.');
12450
+ this.result = void 0;
12451
+ }
12452
 
12453
+ }
12454
+ class SkipAniamtionSignal extends Error {
12455
+ constructor() {
12456
+ super('SkipAnimationSignal');
12457
+ this.result = void 0;
12458
+ }
12459
 
12460
+ }
12461
 
12462
+ const isFrameValue = value => value instanceof FrameValue;
12463
+ let nextId$1 = 1;
12464
+ class FrameValue extends FluidValue {
12465
+ constructor(...args) {
12466
+ super(...args);
12467
+ this.id = nextId$1++;
12468
+ this.key = void 0;
12469
+ this._priority = 0;
12470
+ }
12471
 
12472
+ get priority() {
12473
+ return this._priority;
12474
+ }
 
12475
 
12476
+ set priority(priority) {
12477
+ if (this._priority != priority) {
12478
+ this._priority = priority;
 
 
 
 
 
12479
 
12480
+ this._onPriorityChange(priority);
12481
+ }
12482
+ }
12483
 
12484
+ get() {
12485
+ const node = getAnimated(this);
12486
+ return node && node.getValue();
12487
+ }
 
 
 
12488
 
12489
+ to(...args) {
12490
+ return globals.to(this, args);
12491
  }
12492
 
12493
+ interpolate(...args) {
12494
+ react_spring_shared_esm_deprecateInterpolate();
12495
+ return globals.to(this, args);
 
 
 
 
 
12496
  }
12497
 
12498
+ toJSON() {
12499
+ return this.get();
12500
+ }
 
 
 
 
 
 
 
 
 
12501
 
12502
+ observerAdded(count) {
12503
+ if (count == 1) this._attach();
12504
+ }
 
 
 
 
 
 
12505
 
12506
+ observerRemoved(count) {
12507
+ if (count == 0) this._detach();
12508
+ }
12509
 
12510
+ _attach() {}
 
 
12511
 
12512
+ _detach() {}
12513
 
12514
+ _onChange(value, idle = false) {
12515
+ callFluidObservers(this, {
12516
+ type: 'change',
12517
+ parent: this,
12518
+ value,
12519
+ idle
12520
+ });
12521
+ }
 
12522
 
12523
+ _onPriorityChange(priority) {
12524
+ if (!this.idle) {
12525
+ frameLoop.sort(this);
12526
+ }
12527
 
12528
+ callFluidObservers(this, {
12529
+ type: 'priority',
12530
+ parent: this,
12531
+ priority
12532
+ });
12533
  }
12534
 
 
 
 
12535
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12536
 
12537
+ const $P = Symbol.for('SpringPhase');
12538
+ const HAS_ANIMATED = 1;
12539
+ const IS_ANIMATING = 2;
12540
+ const IS_PAUSED = 4;
12541
+ const hasAnimated = target => (target[$P] & HAS_ANIMATED) > 0;
12542
+ const isAnimating = target => (target[$P] & IS_ANIMATING) > 0;
12543
+ const isPaused = target => (target[$P] & IS_PAUSED) > 0;
12544
+ const setActiveBit = (target, active) => active ? target[$P] |= IS_ANIMATING | HAS_ANIMATED : target[$P] &= ~IS_ANIMATING;
12545
+ const setPausedBit = (target, paused) => paused ? target[$P] |= IS_PAUSED : target[$P] &= ~IS_PAUSED;
12546
 
12547
+ class SpringValue extends FrameValue {
12548
+ constructor(arg1, arg2) {
12549
+ super();
12550
+ this.key = void 0;
12551
+ this.animation = new Animation();
12552
+ this.queue = void 0;
12553
+ this.defaultProps = {};
12554
+ this._state = {
12555
+ paused: false,
12556
+ pauseQueue: new Set(),
12557
+ resumeQueue: new Set(),
12558
+ timeouts: new Set()
12559
+ };
12560
+ this._pendingCalls = new Set();
12561
+ this._lastCallId = 0;
12562
+ this._lastToId = 0;
12563
+ this._memoizedDuration = 0;
12564
 
12565
+ if (!react_spring_shared_esm_is.und(arg1) || !react_spring_shared_esm_is.und(arg2)) {
12566
+ const props = react_spring_shared_esm_is.obj(arg1) ? react_spring_core_esm_extends({}, arg1) : react_spring_core_esm_extends({}, arg2, {
12567
+ from: arg1
12568
+ });
12569
 
12570
+ if (react_spring_shared_esm_is.und(props.default)) {
12571
+ props.default = true;
12572
+ }
12573
 
12574
+ this.start(props);
12575
+ }
12576
+ }
12577
 
12578
+ get idle() {
12579
+ return !(isAnimating(this) || this._state.asyncTo) || isPaused(this);
12580
+ }
12581
 
12582
+ get goal() {
12583
+ return getFluidValue(this.animation.to);
12584
+ }
12585
 
12586
+ get velocity() {
12587
+ const node = getAnimated(this);
12588
+ return node instanceof AnimatedValue ? node.lastVelocity || 0 : node.getPayload().map(node => node.lastVelocity || 0);
12589
+ }
12590
 
12591
+ get hasAnimated() {
12592
+ return hasAnimated(this);
12593
+ }
 
 
12594
 
12595
+ get isAnimating() {
12596
+ return isAnimating(this);
12597
+ }
 
12598
 
12599
+ get isPaused() {
12600
+ return isPaused(this);
12601
+ }
12602
+
12603
+ advance(dt) {
12604
+ let idle = true;
12605
+ let changed = false;
12606
+ const anim = this.animation;
12607
+ let {
12608
+ config,
12609
+ toValues
12610
+ } = anim;
12611
+ const payload = getPayload(anim.to);
12612
+
12613
+ if (!payload && hasFluidValue(anim.to)) {
12614
+ toValues = react_spring_shared_esm_toArray(getFluidValue(anim.to));
12615
  }
 
12616
 
12617
+ anim.values.forEach((node, i) => {
12618
+ if (node.done) return;
12619
+ const to = node.constructor == AnimatedString ? 1 : payload ? payload[i].lastPosition : toValues[i];
12620
+ let finished = anim.immediate;
12621
+ let position = to;
 
12622
 
12623
+ if (!finished) {
12624
+ position = node.lastPosition;
 
 
 
12625
 
12626
+ if (config.tension <= 0) {
12627
+ node.done = true;
12628
+ return;
12629
+ }
12630
 
12631
+ let elapsed = node.elapsedTime += dt;
12632
+ const from = anim.fromValues[i];
12633
+ const v0 = node.v0 != null ? node.v0 : node.v0 = react_spring_shared_esm_is.arr(config.velocity) ? config.velocity[i] : config.velocity;
12634
+ let velocity;
12635
 
12636
+ if (!react_spring_shared_esm_is.und(config.duration)) {
12637
+ let p = 1;
 
 
 
12638
 
12639
+ if (config.duration > 0) {
12640
+ if (this._memoizedDuration !== config.duration) {
12641
+ this._memoizedDuration = config.duration;
 
 
12642
 
12643
+ if (node.durationProgress > 0) {
12644
+ node.elapsedTime = config.duration * node.durationProgress;
12645
+ elapsed = node.elapsedTime += dt;
12646
+ }
12647
+ }
12648
 
12649
+ p = (config.progress || 0) + elapsed / this._memoizedDuration;
12650
+ p = p > 1 ? 1 : p < 0 ? 0 : p;
12651
+ node.durationProgress = p;
12652
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
12653
 
12654
+ position = from + config.easing(p) * (to - from);
12655
+ velocity = (position - node.lastPosition) / dt;
12656
+ finished = p == 1;
12657
+ } else if (config.decay) {
12658
+ const decay = config.decay === true ? 0.998 : config.decay;
12659
+ const e = Math.exp(-(1 - decay) * elapsed);
12660
+ position = from + v0 / (1 - decay) * (1 - e);
12661
+ finished = Math.abs(node.lastPosition - position) < 0.1;
12662
+ velocity = v0 * e;
12663
+ } else {
12664
+ velocity = node.lastVelocity == null ? v0 : node.lastVelocity;
12665
+ const precision = config.precision || (from == to ? 0.005 : Math.min(1, Math.abs(to - from) * 0.001));
12666
+ const restVelocity = config.restVelocity || precision / 10;
12667
+ const bounceFactor = config.clamp ? 0 : config.bounce;
12668
+ const canBounce = !react_spring_shared_esm_is.und(bounceFactor);
12669
+ const isGrowing = from == to ? node.v0 > 0 : from < to;
12670
+ let isMoving;
12671
+ let isBouncing = false;
12672
+ const step = 1;
12673
+ const numSteps = Math.ceil(dt / step);
12674
 
12675
+ for (let n = 0; n < numSteps; ++n) {
12676
+ isMoving = Math.abs(velocity) > restVelocity;
 
12677
 
12678
+ if (!isMoving) {
12679
+ finished = Math.abs(to - position) <= precision;
 
12680
 
12681
+ if (finished) {
12682
+ break;
12683
+ }
12684
+ }
12685
 
12686
+ if (canBounce) {
12687
+ isBouncing = position == to || position > to == isGrowing;
12688
 
12689
+ if (isBouncing) {
12690
+ velocity = -velocity * bounceFactor;
12691
+ position = to;
12692
+ }
12693
+ }
12694
 
12695
+ const springForce = -config.tension * 0.000001 * (position - to);
12696
+ const dampingForce = -config.friction * 0.001 * velocity;
12697
+ const acceleration = (springForce + dampingForce) / config.mass;
12698
+ velocity = velocity + acceleration * step;
12699
+ position = position + velocity * step;
12700
+ }
12701
+ }
 
12702
 
12703
+ node.lastVelocity = velocity;
 
12704
 
12705
+ if (Number.isNaN(position)) {
12706
+ console.warn(`Got NaN while animating:`, this);
12707
+ finished = true;
12708
+ }
12709
+ }
 
12710
 
12711
+ if (payload && !payload[i].done) {
12712
+ finished = false;
12713
+ }
12714
 
12715
+ if (finished) {
12716
+ node.done = true;
12717
+ } else {
12718
+ idle = false;
12719
+ }
12720
+
12721
+ if (node.setValue(position, config.round)) {
12722
+ changed = true;
12723
  }
 
 
 
12724
  });
12725
+ const node = getAnimated(this);
12726
+ const currVal = node.getValue();
12727
 
12728
+ if (idle) {
12729
+ const finalVal = getFluidValue(anim.to);
 
 
 
 
 
 
 
 
 
12730
 
12731
+ if ((currVal !== finalVal || changed) && !config.decay) {
12732
+ node.setValue(finalVal);
 
 
 
 
 
 
12733
 
12734
+ this._onChange(finalVal);
12735
+ } else if (changed && config.decay) {
12736
+ this._onChange(currVal);
12737
+ }
12738
 
12739
+ this._stop();
12740
+ } else if (changed) {
12741
+ this._onChange(currVal);
12742
+ }
12743
+ }
12744
 
12745
+ set(value) {
12746
+ raf.batchedUpdates(() => {
12747
+ this._stop();
12748
 
12749
+ this._focus(value);
12750
 
12751
+ this._set(value);
12752
+ });
12753
+ return this;
12754
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12755
 
12756
+ pause() {
12757
+ this._update({
12758
+ pause: true
12759
+ });
12760
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12761
 
12762
+ resume() {
12763
+ this._update({
12764
+ pause: false
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12765
  });
12766
+ }
 
12767
 
12768
+ finish() {
12769
+ if (isAnimating(this)) {
12770
+ const {
12771
+ to,
12772
+ config
12773
+ } = this.animation;
12774
+ raf.batchedUpdates(() => {
12775
+ this._onStart();
12776
 
12777
+ if (!config.decay) {
12778
+ this._set(to, false);
 
 
 
 
 
 
 
 
 
 
12779
  }
12780
+
12781
+ this._stop();
12782
  });
12783
+ }
 
 
12784
 
12785
+ return this;
12786
+ }
12787
 
12788
+ update(props) {
12789
+ const queue = this.queue || (this.queue = []);
12790
+ queue.push(props);
12791
+ return this;
12792
+ }
 
 
 
 
 
 
 
 
 
 
 
 
12793
 
12794
+ start(to, arg2) {
12795
+ let queue;
12796
 
12797
+ if (!react_spring_shared_esm_is.und(to)) {
12798
+ queue = [react_spring_shared_esm_is.obj(to) ? to : react_spring_core_esm_extends({}, arg2, {
12799
+ to
12800
+ })];
12801
+ } else {
12802
+ queue = this.queue || [];
12803
+ this.queue = [];
12804
  }
12805
 
12806
+ return Promise.all(queue.map(props => this._update(props))).then(results => getCombinedResult(this, results));
12807
+ }
 
 
 
12808
 
12809
+ stop(cancel) {
12810
+ const {
12811
+ to
12812
+ } = this.animation;
12813
 
12814
+ this._focus(this.get());
 
 
12815
 
12816
+ stopAsync(this._state, cancel && this._lastCallId);
12817
+ raf.batchedUpdates(() => this._stop(to, cancel));
12818
+ return this;
12819
+ }
12820
 
12821
+ reset() {
12822
+ this._update({
12823
+ reset: true
12824
+ });
12825
+ }
12826
 
12827
+ eventObserved(event) {
12828
+ if (event.type == 'change') {
12829
+ this._start();
12830
+ } else if (event.type == 'priority') {
12831
+ this.priority = event.priority + 1;
12832
  }
12833
+ }
12834
 
12835
+ _prepareNode(props) {
12836
+ const key = this.key || '';
12837
+ let {
12838
+ to,
12839
+ from
12840
+ } = props;
12841
+ to = react_spring_shared_esm_is.obj(to) ? to[key] : to;
12842
 
12843
+ if (to == null || isAsyncTo(to)) {
12844
+ to = undefined;
 
12845
  }
12846
 
12847
+ from = react_spring_shared_esm_is.obj(from) ? from[key] : from;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12848
 
12849
+ if (from == null) {
12850
+ from = undefined;
12851
+ }
12852
 
12853
+ const range = {
12854
+ to,
12855
+ from
12856
+ };
12857
 
12858
+ if (!hasAnimated(this)) {
12859
+ if (props.reverse) [to, from] = [from, to];
12860
+ from = getFluidValue(from);
12861
 
12862
+ if (!react_spring_shared_esm_is.und(from)) {
12863
+ this._set(from);
12864
+ } else if (!getAnimated(this)) {
12865
+ this._set(to);
12866
+ }
12867
+ }
12868
 
12869
+ return range;
12870
+ }
12871
 
12872
+ _update(_ref, isLoop) {
12873
+ let props = react_spring_core_esm_extends({}, _ref);
12874
 
12875
+ const {
12876
+ key,
12877
+ defaultProps
12878
+ } = this;
12879
+ if (props.default) Object.assign(defaultProps, getDefaultProps(props, (value, prop) => /^on/.test(prop) ? resolveProp(value, key) : value));
12880
+ mergeActiveFn(this, props, 'onProps');
12881
+ sendEvent(this, 'onProps', props, this);
12882
 
12883
+ const range = this._prepareNode(props);
 
 
 
12884
 
12885
+ if (Object.isFrozen(this)) {
12886
+ throw Error('Cannot animate a `SpringValue` object that is frozen. ' + 'Did you forget to pass your component to `animated(...)` before animating its props?');
12887
+ }
 
 
 
 
 
12888
 
12889
+ const state = this._state;
12890
+ return scheduleProps(++this._lastCallId, {
12891
+ key,
12892
+ props,
12893
+ defaultProps,
12894
+ state,
12895
+ actions: {
12896
+ pause: () => {
12897
+ if (!isPaused(this)) {
12898
+ setPausedBit(this, true);
12899
+ flushCalls(state.pauseQueue);
12900
+ sendEvent(this, 'onPause', getFinishedResult(this, checkFinished(this, this.animation.to)), this);
12901
+ }
12902
+ },
12903
+ resume: () => {
12904
+ if (isPaused(this)) {
12905
+ setPausedBit(this, false);
12906
 
12907
+ if (isAnimating(this)) {
12908
+ this._resume();
12909
+ }
 
 
 
 
 
12910
 
12911
+ flushCalls(state.resumeQueue);
12912
+ sendEvent(this, 'onResume', getFinishedResult(this, checkFinished(this, this.animation.to)), this);
12913
+ }
12914
+ },
12915
+ start: this._merge.bind(this, range)
12916
+ }
12917
+ }).then(result => {
12918
+ if (props.loop && result.finished && !(isLoop && result.noop)) {
12919
+ const nextProps = createLoopUpdate(props);
12920
 
12921
+ if (nextProps) {
12922
+ return this._update(nextProps, true);
 
 
 
 
12923
  }
12924
+ }
12925
+
12926
+ return result;
12927
  });
12928
+ }
12929
 
12930
+ _merge(range, props, resolve) {
12931
+ if (props.cancel) {
12932
+ this.stop(true);
12933
+ return resolve(getCancelledResult(this));
 
 
 
 
 
12934
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12935
 
12936
+ const hasToProp = !react_spring_shared_esm_is.und(range.to);
12937
+ const hasFromProp = !react_spring_shared_esm_is.und(range.from);
12938
 
12939
+ if (hasToProp || hasFromProp) {
12940
+ if (props.callId > this._lastToId) {
12941
+ this._lastToId = props.callId;
12942
+ } else {
12943
+ return resolve(getCancelledResult(this));
12944
+ }
12945
+ }
12946
 
12947
+ const {
12948
+ key,
12949
+ defaultProps,
12950
+ animation: anim
12951
+ } = this;
12952
+ const {
12953
+ to: prevTo,
12954
+ from: prevFrom
12955
+ } = anim;
12956
+ let {
12957
+ to = prevTo,
12958
+ from = prevFrom
12959
+ } = range;
12960
 
12961
+ if (hasFromProp && !hasToProp && (!props.default || react_spring_shared_esm_is.und(to))) {
12962
+ to = from;
12963
+ }
12964
 
12965
+ if (props.reverse) [to, from] = [from, to];
12966
+ const hasFromChanged = !isEqual(from, prevFrom);
12967
 
12968
+ if (hasFromChanged) {
12969
+ anim.from = from;
12970
+ }
12971
 
12972
+ from = getFluidValue(from);
12973
+ const hasToChanged = !isEqual(to, prevTo);
12974
 
12975
+ if (hasToChanged) {
12976
+ this._focus(to);
12977
+ }
 
 
 
 
12978
 
12979
+ const hasAsyncTo = isAsyncTo(props.to);
12980
+ const {
12981
+ config
12982
+ } = anim;
12983
+ const {
12984
+ decay,
12985
+ velocity
12986
+ } = config;
12987
 
12988
+ if (hasToProp || hasFromProp) {
12989
+ config.velocity = 0;
12990
+ }
12991
 
12992
+ if (props.config && !hasAsyncTo) {
12993
+ mergeConfig(config, callProp(props.config, key), props.config !== defaultProps.config ? callProp(defaultProps.config, key) : void 0);
12994
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12995
 
12996
+ let node = getAnimated(this);
12997
 
12998
+ if (!node || react_spring_shared_esm_is.und(to)) {
12999
+ return resolve(getFinishedResult(this, true));
13000
+ }
13001
 
13002
+ const reset = react_spring_shared_esm_is.und(props.reset) ? hasFromProp && !props.default : !react_spring_shared_esm_is.und(from) && matchProp(props.reset, key);
13003
+ const value = reset ? from : this.get();
13004
+ const goal = computeGoal(to);
13005
+ const isAnimatable = react_spring_shared_esm_is.num(goal) || react_spring_shared_esm_is.arr(goal) || isAnimatedString(goal);
13006
+ const immediate = !hasAsyncTo && (!isAnimatable || matchProp(defaultProps.immediate || props.immediate, key));
13007
 
13008
+ if (hasToChanged) {
13009
+ const nodeType = getAnimatedType(to);
13010
 
13011
+ if (nodeType !== node.constructor) {
13012
+ if (immediate) {
13013
+ node = this._set(goal);
13014
+ } else throw Error(`Cannot animate between ${node.constructor.name} and ${nodeType.name}, as the "to" prop suggests`);
13015
+ }
13016
+ }
13017
 
13018
+ const goalType = node.constructor;
13019
+ let started = hasFluidValue(to);
13020
+ let finished = false;
13021
 
13022
+ if (!started) {
13023
+ const hasValueChanged = reset || !hasAnimated(this) && hasFromChanged;
13024
 
13025
+ if (hasToChanged || hasValueChanged) {
13026
+ finished = isEqual(computeGoal(value), goal);
13027
+ started = !finished;
13028
+ }
13029
 
13030
+ if (!isEqual(anim.immediate, immediate) && !immediate || !isEqual(config.decay, decay) || !isEqual(config.velocity, velocity)) {
13031
+ started = true;
13032
+ }
13033
+ }
13034
 
13035
+ if (finished && isAnimating(this)) {
13036
+ if (anim.changed && !reset) {
13037
+ started = true;
13038
+ } else if (!started) {
13039
+ this._stop(prevTo);
13040
+ }
13041
+ }
13042
 
13043
+ if (!hasAsyncTo) {
13044
+ if (started || hasFluidValue(prevTo)) {
13045
+ anim.values = node.getPayload();
13046
+ anim.toValues = hasFluidValue(to) ? null : goalType == AnimatedString ? [1] : react_spring_shared_esm_toArray(goal);
13047
+ }
 
13048
 
13049
+ if (anim.immediate != immediate) {
13050
+ anim.immediate = immediate;
 
 
13051
 
13052
+ if (!immediate && !reset) {
13053
+ this._set(prevTo);
13054
+ }
13055
+ }
13056
 
13057
+ if (started) {
13058
+ const {
13059
+ onRest
13060
+ } = anim;
13061
+ react_spring_shared_esm_each(ACTIVE_EVENTS, type => mergeActiveFn(this, props, type));
13062
+ const result = getFinishedResult(this, checkFinished(this, prevTo));
13063
+ flushCalls(this._pendingCalls, result);
 
13064
 
13065
+ this._pendingCalls.add(resolve);
 
 
 
13066
 
13067
+ if (anim.changed) raf.batchedUpdates(() => {
13068
+ anim.changed = !reset;
13069
+ onRest == null ? void 0 : onRest(result, this);
13070
 
13071
+ if (reset) {
13072
+ callProp(defaultProps.onRest, result);
13073
+ } else {
13074
+ anim.onStart == null ? void 0 : anim.onStart(result, this);
13075
+ }
13076
+ });
13077
+ }
13078
+ }
13079
 
13080
+ if (reset) {
13081
+ this._set(value);
13082
+ }
 
 
 
 
 
 
 
 
 
13083
 
13084
+ if (hasAsyncTo) {
13085
+ resolve(runAsync(props.to, props, this._state, this));
13086
+ } else if (started) {
13087
+ this._start();
13088
+ } else if (isAnimating(this) && !hasToChanged) {
13089
+ this._pendingCalls.add(resolve);
13090
+ } else {
13091
+ resolve(getNoopResult(value));
13092
+ }
13093
+ }
 
 
 
13094
 
13095
+ _focus(value) {
13096
+ const anim = this.animation;
 
 
 
 
 
 
 
 
 
 
 
 
13097
 
13098
+ if (value !== anim.to) {
13099
+ if (getFluidObservers(this)) {
13100
+ this._detach();
13101
+ }
 
 
 
 
 
 
 
13102
 
13103
+ anim.to = value;
 
 
 
 
13104
 
13105
+ if (getFluidObservers(this)) {
13106
+ this._attach();
13107
+ }
13108
  }
13109
  }
13110
 
13111
+ _attach() {
13112
+ let priority = 0;
13113
+ const {
13114
+ to
13115
+ } = this.animation;
 
 
 
 
 
 
 
13116
 
13117
+ if (hasFluidValue(to)) {
13118
+ addFluidObserver(to, this);
 
 
13119
 
13120
+ if (isFrameValue(to)) {
13121
+ priority = to.priority + 1;
13122
+ }
13123
+ }
13124
+
13125
+ this.priority = priority;
13126
  }
13127
 
13128
+ _detach() {
13129
+ const {
13130
+ to
13131
+ } = this.animation;
 
 
 
 
 
 
 
 
13132
 
13133
+ if (hasFluidValue(to)) {
13134
+ removeFluidObserver(to, this);
13135
+ }
13136
  }
13137
 
13138
+ _set(arg, idle = true) {
13139
+ const value = getFluidValue(arg);
 
 
 
13140
 
13141
+ if (!react_spring_shared_esm_is.und(value)) {
13142
+ const oldNode = getAnimated(this);
13143
 
13144
+ if (!oldNode || !isEqual(value, oldNode.getValue())) {
13145
+ const nodeType = getAnimatedType(value);
 
13146
 
13147
+ if (!oldNode || oldNode.constructor != nodeType) {
13148
+ setAnimated(this, nodeType.create(value));
13149
+ } else {
13150
+ oldNode.setValue(value);
13151
+ }
13152
 
13153
+ if (oldNode) {
13154
+ raf.batchedUpdates(() => {
13155
+ this._onChange(value, idle);
13156
+ });
13157
+ }
13158
+ }
13159
+ }
13160
 
13161
+ return getAnimated(this);
13162
+ }
13163
 
13164
+ _onStart() {
13165
+ const anim = this.animation;
 
 
 
 
 
 
13166
 
13167
+ if (!anim.changed) {
13168
+ anim.changed = true;
13169
+ sendEvent(this, 'onStart', getFinishedResult(this, checkFinished(this, anim.to)), this);
13170
+ }
13171
+ }
13172
 
13173
+ _onChange(value, idle) {
13174
+ if (!idle) {
13175
+ this._onStart();
13176
 
13177
+ callProp(this.animation.onChange, value, this);
13178
+ }
 
13179
 
13180
+ callProp(this.defaultProps.onChange, value, this);
13181
 
13182
+ super._onChange(value, idle);
13183
+ }
13184
 
13185
+ _start() {
13186
+ const anim = this.animation;
13187
+ getAnimated(this).reset(getFluidValue(anim.to));
13188
 
13189
+ if (!anim.immediate) {
13190
+ anim.fromValues = anim.values.map(node => node.lastPosition);
13191
+ }
13192
 
13193
+ if (!isAnimating(this)) {
13194
+ setActiveBit(this, true);
13195
 
13196
+ if (!isPaused(this)) {
13197
+ this._resume();
13198
+ }
13199
+ }
13200
+ }
13201
 
13202
+ _resume() {
13203
+ if (globals.skipAnimation) {
13204
+ this.finish();
13205
+ } else {
13206
+ frameLoop.start(this);
13207
+ }
13208
+ }
13209
 
13210
+ _stop(goal, cancel) {
13211
+ if (isAnimating(this)) {
13212
+ setActiveBit(this, false);
13213
+ const anim = this.animation;
13214
+ react_spring_shared_esm_each(anim.values, node => {
13215
+ node.done = true;
13216
+ });
 
 
13217
 
13218
+ if (anim.toValues) {
13219
+ anim.onChange = anim.onPause = anim.onResume = undefined;
13220
+ }
 
13221
 
13222
+ callFluidObservers(this, {
13223
+ type: 'idle',
13224
+ parent: this
13225
+ });
13226
+ const result = cancel ? getCancelledResult(this.get()) : getFinishedResult(this.get(), checkFinished(this, goal != null ? goal : anim.to));
13227
+ flushCalls(this._pendingCalls, result);
13228
 
13229
+ if (anim.changed) {
13230
+ anim.changed = false;
13231
+ sendEvent(this, 'onRest', result, this);
 
13232
  }
13233
+ }
13234
  }
13235
 
 
13236
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13237
 
13238
+ function checkFinished(target, to) {
13239
+ const goal = computeGoal(to);
13240
+ const value = computeGoal(target.get());
13241
+ return isEqual(value, goal);
13242
+ }
13243
 
13244
+ function createLoopUpdate(props, loop = props.loop, to = props.to) {
13245
+ let loopRet = callProp(loop);
13246
 
13247
+ if (loopRet) {
13248
+ const overrides = loopRet !== true && inferTo(loopRet);
13249
+ const reverse = (overrides || props).reverse;
13250
+ const reset = !overrides || overrides.reset;
13251
+ return createUpdate(react_spring_core_esm_extends({}, props, {
13252
+ loop,
13253
+ default: false,
13254
+ pause: undefined,
13255
+ to: !reverse || isAsyncTo(to) ? to : undefined,
13256
+ from: reset ? props.from : undefined,
13257
+ reset
13258
+ }, overrides));
13259
+ }
13260
+ }
13261
+ function createUpdate(props) {
13262
+ const {
13263
+ to,
13264
+ from
13265
+ } = props = inferTo(props);
13266
+ const keys = new Set();
13267
+ if (react_spring_shared_esm_is.obj(to)) findDefined(to, keys);
13268
+ if (react_spring_shared_esm_is.obj(from)) findDefined(from, keys);
13269
+ props.keys = keys.size ? Array.from(keys) : null;
13270
  return props;
13271
  }
13272
+ function declareUpdate(props) {
13273
+ const update = createUpdate(props);
 
 
 
 
 
 
 
13274
 
13275
+ if (react_spring_shared_esm_is.und(update.default)) {
13276
+ update.default = getDefaultProps(update);
 
13277
  }
13278
 
13279
+ return update;
13280
+ }
13281
 
13282
+ function findDefined(values, keys) {
13283
+ eachProp(values, (value, key) => value != null && keys.add(key));
13284
+ }
13285
 
13286
+ const ACTIVE_EVENTS = ['onStart', 'onRest', 'onChange', 'onPause', 'onResume'];
 
 
13287
 
13288
+ function mergeActiveFn(target, props, type) {
13289
+ target.animation[type] = props[type] !== getDefaultProp(props, type) ? resolveProp(props[type], target.key) : undefined;
13290
+ }
13291
 
13292
+ function sendEvent(target, type, ...args) {
13293
+ var _target$animation$typ, _target$animation, _target$defaultProps$, _target$defaultProps;
 
 
 
 
 
 
 
13294
 
13295
+ (_target$animation$typ = (_target$animation = target.animation)[type]) == null ? void 0 : _target$animation$typ.call(_target$animation, ...args);
13296
+ (_target$defaultProps$ = (_target$defaultProps = target.defaultProps)[type]) == null ? void 0 : _target$defaultProps$.call(_target$defaultProps, ...args);
13297
+ }
13298
 
13299
+ const BATCHED_EVENTS = ['onStart', 'onChange', 'onRest'];
13300
+ let nextId = 1;
13301
+ class Controller {
13302
+ constructor(props, flush) {
13303
+ this.id = nextId++;
13304
+ this.springs = {};
13305
+ this.queue = [];
13306
+ this.ref = void 0;
13307
+ this._flush = void 0;
13308
+ this._initialProps = void 0;
13309
+ this._lastAsyncId = 0;
13310
+ this._active = new Set();
13311
+ this._changed = new Set();
13312
+ this._started = false;
13313
+ this._item = void 0;
13314
+ this._state = {
13315
+ paused: false,
13316
+ pauseQueue: new Set(),
13317
+ resumeQueue: new Set(),
13318
+ timeouts: new Set()
13319
+ };
13320
+ this._events = {
13321
+ onStart: new Map(),
13322
+ onChange: new Map(),
13323
+ onRest: new Map()
13324
+ };
13325
+ this._onFrame = this._onFrame.bind(this);
13326
 
13327
+ if (flush) {
13328
+ this._flush = flush;
13329
+ }
 
 
 
 
 
 
13330
 
13331
+ if (props) {
13332
+ this.start(react_spring_core_esm_extends({
13333
+ default: true
13334
+ }, props));
13335
+ }
13336
+ }
 
 
 
 
 
13337
 
13338
+ get idle() {
13339
+ return !this._state.asyncTo && Object.values(this.springs).every(spring => spring.idle);
13340
  }
13341
 
13342
+ get item() {
13343
+ return this._item;
13344
+ }
 
 
 
 
 
 
 
 
 
 
13345
 
13346
+ set item(item) {
13347
+ this._item = item;
13348
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
13349
 
13350
+ get() {
13351
+ const values = {};
13352
+ this.each((spring, key) => values[key] = spring.get());
13353
+ return values;
13354
+ }
13355
 
13356
+ set(values) {
13357
+ for (const key in values) {
13358
+ const value = values[key];
 
 
 
 
 
 
 
 
 
13359
 
13360
+ if (!react_spring_shared_esm_is.und(value)) {
13361
+ this.springs[key].set(value);
13362
+ }
13363
+ }
13364
  }
13365
 
13366
+ update(props) {
13367
+ if (props) {
13368
+ this.queue.push(createUpdate(props));
 
 
 
 
13369
  }
 
 
 
 
 
 
 
 
 
13370
 
13371
+ return this;
13372
+ }
13373
 
13374
+ start(props) {
13375
+ let {
13376
+ queue
13377
+ } = this;
13378
 
13379
+ if (props) {
13380
+ queue = react_spring_shared_esm_toArray(props).map(createUpdate);
13381
+ } else {
13382
+ this.queue = [];
13383
+ }
13384
 
13385
+ if (this._flush) {
13386
+ return this._flush(this, queue);
13387
+ }
13388
 
13389
+ prepareKeys(this, queue);
13390
+ return flushUpdateQueue(this, queue);
13391
+ }
13392
 
13393
+ stop(arg, keys) {
13394
+ if (arg !== !!arg) {
13395
+ keys = arg;
13396
+ }
 
 
 
 
13397
 
13398
+ if (keys) {
13399
+ const springs = this.springs;
13400
+ react_spring_shared_esm_each(react_spring_shared_esm_toArray(keys), key => springs[key].stop(!!arg));
13401
+ } else {
13402
+ stopAsync(this._state, this._lastAsyncId);
13403
+ this.each(spring => spring.stop(!!arg));
 
 
 
 
13404
  }
 
 
 
 
 
 
 
 
 
 
 
13405
 
13406
+ return this;
13407
+ }
13408
 
13409
+ pause(keys) {
13410
+ if (react_spring_shared_esm_is.und(keys)) {
13411
+ this.start({
13412
+ pause: true
13413
+ });
13414
+ } else {
13415
+ const springs = this.springs;
13416
+ react_spring_shared_esm_each(react_spring_shared_esm_toArray(keys), key => springs[key].pause());
13417
+ }
13418
 
13419
+ return this;
13420
+ }
 
13421
 
13422
+ resume(keys) {
13423
+ if (react_spring_shared_esm_is.und(keys)) {
13424
+ this.start({
13425
+ pause: false
13426
+ });
13427
+ } else {
13428
+ const springs = this.springs;
13429
+ react_spring_shared_esm_each(react_spring_shared_esm_toArray(keys), key => springs[key].resume());
13430
+ }
13431
 
13432
+ return this;
13433
+ }
13434
 
13435
+ each(iterator) {
13436
+ eachProp(this.springs, iterator);
13437
+ }
13438
 
13439
+ _onFrame() {
13440
+ const {
13441
+ onStart,
13442
+ onChange,
13443
+ onRest
13444
+ } = this._events;
13445
+ const active = this._active.size > 0;
13446
+ const changed = this._changed.size > 0;
13447
 
13448
+ if (active && !this._started || changed && !this._started) {
13449
+ this._started = true;
13450
+ flush(onStart, ([onStart, result]) => {
13451
+ result.value = this.get();
13452
+ onStart(result, this, this._item);
13453
+ });
13454
+ }
13455
 
13456
+ const idle = !active && this._started;
13457
+ const values = changed || idle && onRest.size ? this.get() : null;
13458
 
13459
+ if (changed && onChange.size) {
13460
+ flush(onChange, ([onChange, result]) => {
13461
+ result.value = values;
13462
+ onChange(result, this, this._item);
13463
+ });
13464
+ }
 
13465
 
13466
+ if (idle) {
13467
+ this._started = false;
13468
+ flush(onRest, ([onRest, result]) => {
13469
+ result.value = values;
13470
+ onRest(result, this, this._item);
13471
+ });
13472
+ }
13473
  }
13474
 
13475
+ eventObserved(event) {
13476
+ if (event.type == 'change') {
13477
+ this._changed.add(event.parent);
13478
+
13479
+ if (!event.idle) {
13480
+ this._active.add(event.parent);
13481
+ }
13482
+ } else if (event.type == 'idle') {
13483
+ this._active.delete(event.parent);
13484
+ } else return;
13485
+
13486
+ raf.onFrame(this._onFrame);
13487
  }
13488
 
 
 
 
 
13489
  }
13490
+ function flushUpdateQueue(ctrl, queue) {
13491
+ return Promise.all(queue.map(props => flushUpdate(ctrl, props))).then(results => getCombinedResult(ctrl, results));
 
 
 
 
 
 
 
 
 
 
 
13492
  }
13493
+ async function flushUpdate(ctrl, props, isLoop) {
13494
+ const {
13495
+ keys,
13496
+ to,
13497
+ from,
13498
+ loop,
13499
+ onRest,
13500
+ onResolve
13501
+ } = props;
13502
+ const defaults = react_spring_shared_esm_is.obj(props.default) && props.default;
13503
 
13504
+ if (loop) {
13505
+ props.loop = false;
13506
+ }
13507
 
13508
+ if (to === false) props.to = null;
13509
+ if (from === false) props.from = null;
13510
+ const asyncTo = react_spring_shared_esm_is.arr(to) || react_spring_shared_esm_is.fun(to) ? to : undefined;
13511
 
13512
+ if (asyncTo) {
13513
+ props.to = undefined;
13514
+ props.onRest = undefined;
13515
 
13516
+ if (defaults) {
13517
+ defaults.onRest = undefined;
13518
+ }
13519
+ } else {
13520
+ react_spring_shared_esm_each(BATCHED_EVENTS, key => {
13521
+ const handler = props[key];
13522
 
13523
+ if (react_spring_shared_esm_is.fun(handler)) {
13524
+ const queue = ctrl['_events'][key];
 
13525
 
13526
+ props[key] = ({
13527
+ finished,
13528
+ cancelled
13529
+ }) => {
13530
+ const result = queue.get(handler);
13531
 
13532
+ if (result) {
13533
+ if (!finished) result.finished = false;
13534
+ if (cancelled) result.cancelled = true;
13535
+ } else {
13536
+ queue.set(handler, {
13537
+ value: null,
13538
+ finished: finished || false,
13539
+ cancelled: cancelled || false
13540
+ });
13541
+ }
13542
+ };
13543
 
13544
+ if (defaults) {
13545
+ defaults[key] = props[key];
13546
+ }
13547
+ }
13548
+ });
13549
+ }
13550
 
13551
+ const state = ctrl['_state'];
13552
 
13553
+ if (props.pause === !state.paused) {
13554
+ state.paused = props.pause;
13555
+ flushCalls(props.pause ? state.pauseQueue : state.resumeQueue);
13556
+ } else if (state.paused) {
13557
+ props.pause = true;
13558
+ }
13559
 
13560
+ const promises = (keys || Object.keys(ctrl.springs)).map(key => ctrl.springs[key].start(props));
13561
+ const cancel = props.cancel === true || getDefaultProp(props, 'cancel') === true;
13562
 
13563
+ if (asyncTo || cancel && state.asyncId) {
13564
+ promises.push(scheduleProps(++ctrl['_lastAsyncId'], {
13565
+ props,
13566
+ state,
13567
+ actions: {
13568
+ pause: noop,
13569
+ resume: noop,
13570
 
13571
+ start(props, resolve) {
13572
+ if (cancel) {
13573
+ stopAsync(state, ctrl['_lastAsyncId']);
13574
+ resolve(getCancelledResult(ctrl));
13575
+ } else {
13576
+ props.onRest = onRest;
13577
+ resolve(runAsync(asyncTo, props, state, ctrl));
13578
+ }
13579
+ }
13580
 
13581
+ }
13582
+ }));
13583
+ }
13584
 
13585
+ if (state.paused) {
13586
+ await new Promise(resume => {
13587
+ state.resumeQueue.add(resume);
13588
+ });
13589
+ }
 
 
 
 
 
13590
 
13591
+ const result = getCombinedResult(ctrl, await Promise.all(promises));
 
 
13592
 
13593
+ if (loop && result.finished && !(isLoop && result.noop)) {
13594
+ const nextProps = createLoopUpdate(props, loop, to);
 
 
 
 
13595
 
13596
+ if (nextProps) {
13597
+ prepareKeys(ctrl, [nextProps]);
13598
+ return flushUpdate(ctrl, nextProps, true);
13599
+ }
13600
+ }
13601
 
13602
+ if (onResolve) {
13603
+ raf.batchedUpdates(() => onResolve(result, ctrl, ctrl.item));
13604
+ }
13605
 
13606
+ return result;
13607
+ }
13608
+ function getSprings(ctrl, props) {
13609
+ const springs = react_spring_core_esm_extends({}, ctrl.springs);
13610
 
13611
+ if (props) {
13612
+ react_spring_shared_esm_each(react_spring_shared_esm_toArray(props), props => {
13613
+ if (react_spring_shared_esm_is.und(props.keys)) {
13614
+ props = createUpdate(props);
13615
+ }
13616
 
13617
+ if (!react_spring_shared_esm_is.obj(props.to)) {
13618
+ props = react_spring_core_esm_extends({}, props, {
13619
+ to: undefined
13620
+ });
13621
+ }
13622
 
13623
+ prepareSprings(springs, props, key => {
13624
+ return createSpring(key);
13625
+ });
13626
+ });
13627
+ }
13628
 
13629
+ setSprings(ctrl, springs);
13630
+ return springs;
13631
+ }
13632
+ function setSprings(ctrl, springs) {
13633
+ eachProp(springs, (spring, key) => {
13634
+ if (!ctrl.springs[key]) {
13635
+ ctrl.springs[key] = spring;
13636
+ addFluidObserver(spring, ctrl);
13637
+ }
13638
+ });
13639
+ }
13640
 
13641
+ function createSpring(key, observer) {
13642
+ const spring = new SpringValue();
13643
+ spring.key = key;
13644
 
13645
+ if (observer) {
13646
+ addFluidObserver(spring, observer);
13647
+ }
13648
 
13649
+ return spring;
13650
+ }
13651
 
13652
+ function prepareSprings(springs, props, create) {
13653
+ if (props.keys) {
13654
+ react_spring_shared_esm_each(props.keys, key => {
13655
+ const spring = springs[key] || (springs[key] = create(key));
13656
+ spring['_prepareNode'](props);
13657
+ });
13658
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13659
  }
 
 
 
 
 
 
 
 
13660
 
13661
+ function prepareKeys(ctrl, queue) {
13662
+ react_spring_shared_esm_each(queue, props => {
13663
+ prepareSprings(ctrl.springs, props, key => {
13664
+ return createSpring(key, ctrl);
13665
+ });
 
 
 
 
 
 
 
 
13666
  });
13667
  }
 
 
 
 
 
 
13668
 
13669
+ function _objectWithoutPropertiesLoose(source, excluded) {
13670
+ if (source == null) return {};
13671
+ var target = {};
13672
+ var sourceKeys = Object.keys(source);
13673
+ var key, i;
13674
+
13675
+ for (i = 0; i < sourceKeys.length; i++) {
13676
+ key = sourceKeys[i];
13677
+ if (excluded.indexOf(key) >= 0) continue;
13678
+ target[key] = source[key];
13679
+ }
13680
+
13681
+ return target;
13682
  }
 
 
 
 
 
 
 
13683
 
13684
+ const _excluded$3 = ["children"];
13685
+ const SpringContext = _ref => {
13686
+ let {
13687
+ children
13688
+ } = _ref,
13689
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
13690
 
13691
+ const inherited = (0,external_React_.useContext)(ctx);
13692
+ const pause = props.pause || !!inherited.pause,
13693
+ immediate = props.immediate || !!inherited.immediate;
13694
+ props = useMemoOne(() => ({
13695
+ pause,
13696
+ immediate
13697
+ }), [pause, immediate]);
13698
  const {
13699
+ Provider
13700
+ } = ctx;
13701
+ return external_React_.createElement(Provider, {
13702
+ value: props
13703
+ }, children);
13704
+ };
13705
+ const ctx = makeContext(SpringContext, {});
13706
+ SpringContext.Provider = ctx.Provider;
13707
+ SpringContext.Consumer = ctx.Consumer;
 
13708
 
13709
+ function makeContext(target, init) {
13710
+ Object.assign(target, external_React_.createContext(init));
13711
+ target.Provider._context = target;
13712
+ target.Consumer._context = target;
13713
+ return target;
13714
+ }
13715
 
13716
+ const SpringRef = () => {
13717
+ const current = [];
13718
 
13719
+ const SpringRef = function SpringRef(props) {
13720
+ deprecateDirectCall();
13721
+ const results = [];
13722
+ react_spring_shared_esm_each(current, (ctrl, i) => {
13723
+ if (react_spring_shared_esm_is.und(props)) {
13724
+ results.push(ctrl.start());
13725
+ } else {
13726
+ const update = _getProps(props, ctrl, i);
 
 
13727
 
13728
+ if (update) {
13729
+ results.push(ctrl.start(update));
13730
+ }
13731
+ }
13732
+ });
13733
+ return results;
13734
+ };
13735
 
13736
+ SpringRef.current = current;
 
13737
 
13738
+ SpringRef.add = function (ctrl) {
13739
+ if (!current.includes(ctrl)) {
13740
+ current.push(ctrl);
13741
  }
13742
  };
13743
 
13744
+ SpringRef.delete = function (ctrl) {
13745
+ const i = current.indexOf(ctrl);
13746
+ if (~i) current.splice(i, 1);
13747
+ };
 
 
 
 
 
 
 
 
 
 
13748
 
13749
+ SpringRef.pause = function () {
13750
+ react_spring_shared_esm_each(current, ctrl => ctrl.pause(...arguments));
13751
+ return this;
13752
+ };
13753
 
13754
+ SpringRef.resume = function () {
13755
+ react_spring_shared_esm_each(current, ctrl => ctrl.resume(...arguments));
13756
+ return this;
13757
+ };
13758
 
13759
+ SpringRef.set = function (values) {
13760
+ react_spring_shared_esm_each(current, ctrl => ctrl.set(values));
13761
+ };
13762
 
13763
+ SpringRef.start = function (props) {
13764
+ const results = [];
13765
+ react_spring_shared_esm_each(current, (ctrl, i) => {
13766
+ if (react_spring_shared_esm_is.und(props)) {
13767
+ results.push(ctrl.start());
13768
+ } else {
13769
+ const update = this._getProps(props, ctrl, i);
13770
 
13771
+ if (update) {
13772
+ results.push(ctrl.start(update));
13773
+ }
13774
+ }
13775
+ });
13776
+ return results;
13777
+ };
13778
 
13779
+ SpringRef.stop = function () {
13780
+ react_spring_shared_esm_each(current, ctrl => ctrl.stop(...arguments));
13781
+ return this;
13782
+ };
13783
 
13784
+ SpringRef.update = function (props) {
13785
+ react_spring_shared_esm_each(current, (ctrl, i) => ctrl.update(this._getProps(props, ctrl, i)));
13786
+ return this;
13787
+ };
13788
 
13789
+ const _getProps = function _getProps(arg, ctrl, index) {
13790
+ return react_spring_shared_esm_is.fun(arg) ? arg(index, ctrl) : arg;
13791
+ };
13792
 
13793
+ SpringRef._getProps = _getProps;
13794
+ return SpringRef;
13795
+ };
13796
 
13797
+ function useSprings(length, props, deps) {
13798
+ const propsFn = react_spring_shared_esm_is.fun(props) && props;
13799
+ if (propsFn && !deps) deps = [];
13800
+ const ref = (0,external_React_.useMemo)(() => propsFn || arguments.length == 3 ? SpringRef() : void 0, []);
13801
+ const layoutId = (0,external_React_.useRef)(0);
13802
+ const forceUpdate = react_spring_shared_esm_useForceUpdate();
13803
+ const state = (0,external_React_.useMemo)(() => ({
13804
+ ctrls: [],
13805
+ queue: [],
13806
 
13807
+ flush(ctrl, updates) {
13808
+ const springs = getSprings(ctrl, updates);
13809
+ const canFlushSync = layoutId.current > 0 && !state.queue.length && !Object.keys(springs).some(key => !ctrl.springs[key]);
13810
+ return canFlushSync ? flushUpdateQueue(ctrl, updates) : new Promise(resolve => {
13811
+ setSprings(ctrl, springs);
13812
+ state.queue.push(() => {
13813
+ resolve(flushUpdateQueue(ctrl, updates));
13814
+ });
13815
+ forceUpdate();
13816
+ });
13817
+ }
13818
 
13819
+ }), []);
13820
+ const ctrls = (0,external_React_.useRef)([...state.ctrls]);
13821
+ const updates = [];
13822
+ const prevLength = react_spring_shared_esm_usePrev(length) || 0;
13823
+ (0,external_React_.useMemo)(() => {
13824
+ react_spring_shared_esm_each(ctrls.current.slice(length, prevLength), ctrl => {
13825
+ detachRefs(ctrl, ref);
13826
+ ctrl.stop(true);
13827
+ });
13828
+ ctrls.current.length = length;
13829
+ declareUpdates(prevLength, length);
13830
+ }, [length]);
13831
+ (0,external_React_.useMemo)(() => {
13832
+ declareUpdates(0, Math.min(prevLength, length));
13833
+ }, deps);
13834
 
13835
+ function declareUpdates(startIndex, endIndex) {
13836
+ for (let i = startIndex; i < endIndex; i++) {
13837
+ const ctrl = ctrls.current[i] || (ctrls.current[i] = new Controller(null, state.flush));
13838
+ const update = propsFn ? propsFn(i, ctrl) : props[i];
 
 
 
 
 
 
13839
 
13840
+ if (update) {
13841
+ updates[i] = declareUpdate(update);
 
 
 
 
 
 
 
 
 
13842
  }
13843
+ }
13844
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13845
 
13846
+ const springs = ctrls.current.map((ctrl, i) => getSprings(ctrl, updates[i]));
13847
+ const context = (0,external_React_.useContext)(SpringContext);
13848
+ const prevContext = react_spring_shared_esm_usePrev(context);
13849
+ const hasContext = context !== prevContext && hasProps(context);
13850
+ react_spring_shared_esm_useLayoutEffect(() => {
13851
+ layoutId.current++;
13852
+ state.ctrls = ctrls.current;
13853
+ const {
13854
+ queue
13855
+ } = state;
13856
 
13857
+ if (queue.length) {
13858
+ state.queue = [];
13859
+ react_spring_shared_esm_each(queue, cb => cb());
13860
+ }
 
 
 
 
 
 
 
 
13861
 
13862
+ react_spring_shared_esm_each(ctrls.current, (ctrl, i) => {
13863
+ ref == null ? void 0 : ref.add(ctrl);
 
13864
 
13865
+ if (hasContext) {
13866
+ ctrl.start({
13867
+ default: context
13868
+ });
13869
  }
 
 
 
 
 
13870
 
13871
+ const update = updates[i];
13872
+
13873
+ if (update) {
13874
+ replaceRef(ctrl, update.ref);
13875
+
13876
+ if (ctrl.ref) {
13877
+ ctrl.queue.push(update);
13878
+ } else {
13879
+ ctrl.start(update);
13880
+ }
13881
  }
 
 
 
13882
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13883
  });
13884
+ react_spring_shared_esm_useOnce(() => () => {
13885
+ react_spring_shared_esm_each(state.ctrls, ctrl => ctrl.stop(true));
13886
+ });
13887
+ const values = springs.map(x => react_spring_core_esm_extends({}, x));
13888
+ return ref ? [values, ref] : values;
13889
  }
 
 
 
 
 
 
 
 
13890
 
13891
+ function useSpring(props, deps) {
13892
+ const isFn = react_spring_shared_esm_is.fun(props);
13893
+ const [[values], ref] = useSprings(1, isFn ? props : [props], isFn ? deps || [] : deps);
13894
+ return isFn || arguments.length == 2 ? [values, ref] : values;
13895
+ }
13896
 
13897
+ const initSpringRef = () => SpringRef();
13898
 
13899
+ const useSpringRef = () => useState(initSpringRef)[0];
 
 
13900
 
13901
+ function useTrail(length, propsArg, deps) {
13902
+ const propsFn = is.fun(propsArg) && propsArg;
13903
+ if (propsFn && !deps) deps = [];
13904
+ let reverse = true;
13905
+ const result = useSprings(length, (i, ctrl) => {
13906
+ const props = propsFn ? propsFn(i, ctrl) : propsArg;
13907
+ reverse = reverse && props.reverse;
13908
+ return props;
13909
+ }, deps || [{}]);
13910
+ const ref = result[1];
13911
+ useLayoutEffect(() => {
13912
+ each(ref.current, (ctrl, i) => {
13913
+ const parent = ref.current[i + (reverse ? 1 : -1)];
13914
+ if (parent) ctrl.start({
13915
+ to: parent.springs
13916
+ });
13917
+ });
13918
+ }, deps);
13919
 
13920
+ if (propsFn || arguments.length == 3) {
13921
+ ref['_getProps'] = (propsArg, ctrl, i) => {
13922
+ const props = is.fun(propsArg) ? propsArg(i, ctrl) : propsArg;
13923
 
13924
+ if (props) {
13925
+ const parent = ref.current[i + (props.reverse ? 1 : -1)];
13926
+ if (parent) props.to = parent.springs;
13927
+ return props;
13928
+ }
13929
+ };
13930
 
13931
+ return result;
13932
+ }
 
 
 
 
 
13933
 
13934
+ return result[0];
 
 
13935
  }
 
 
 
 
 
 
13936
 
13937
+ let TransitionPhase;
 
13938
 
13939
+ (function (TransitionPhase) {
13940
+ TransitionPhase["MOUNT"] = "mount";
13941
+ TransitionPhase["ENTER"] = "enter";
13942
+ TransitionPhase["UPDATE"] = "update";
13943
+ TransitionPhase["LEAVE"] = "leave";
13944
+ })(TransitionPhase || (TransitionPhase = {}));
 
 
 
 
13945
 
13946
+ function useTransition(data, props, deps) {
13947
+ const propsFn = is.fun(props) && props;
 
 
13948
  const {
13949
+ reset,
13950
+ sort,
13951
+ trail = 0,
13952
+ expires = true,
13953
+ onDestroyed,
13954
+ ref: propsRef,
13955
+ config: propsConfig
13956
+ } = propsFn ? propsFn() : props;
13957
+ const ref = useMemo(() => propsFn || arguments.length == 3 ? SpringRef() : void 0, []);
13958
+ const items = toArray(data);
13959
+ const transitions = [];
13960
+ const usedTransitions = useRef(null);
13961
+ const prevTransitions = reset ? null : usedTransitions.current;
13962
+ useLayoutEffect(() => {
13963
+ usedTransitions.current = transitions;
13964
  });
13965
+ useOnce(() => () => each(usedTransitions.current, t => {
13966
+ if (t.expired) {
13967
+ clearTimeout(t.expirationId);
13968
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13969
 
13970
+ detachRefs(t.ctrl, ref);
13971
+ t.ctrl.stop(true);
13972
+ }));
13973
+ const keys = getKeys(items, propsFn ? propsFn() : props, prevTransitions);
13974
+ const expired = reset && usedTransitions.current || [];
13975
+ useLayoutEffect(() => each(expired, ({
13976
+ ctrl,
13977
+ item,
13978
+ key
13979
+ }) => {
13980
+ detachRefs(ctrl, ref);
13981
+ callProp(onDestroyed, item, key);
13982
+ }));
13983
+ const reused = [];
13984
+ if (prevTransitions) each(prevTransitions, (t, i) => {
13985
+ if (t.expired) {
13986
+ clearTimeout(t.expirationId);
13987
+ expired.push(t);
13988
+ } else {
13989
+ i = reused[i] = keys.indexOf(t.key);
13990
+ if (~i) transitions[i] = t;
13991
+ }
13992
+ });
13993
+ each(items, (item, i) => {
13994
+ if (!transitions[i]) {
13995
+ transitions[i] = {
13996
+ key: keys[i],
13997
+ item,
13998
+ phase: TransitionPhase.MOUNT,
13999
+ ctrl: new Controller()
14000
+ };
14001
+ transitions[i].ctrl.item = item;
14002
+ }
14003
  });
 
 
14004
 
14005
+ if (reused.length) {
14006
+ let i = -1;
14007
+ const {
14008
+ leave
14009
+ } = propsFn ? propsFn() : props;
14010
+ each(reused, (keyIndex, prevIndex) => {
14011
+ const t = prevTransitions[prevIndex];
14012
 
14013
+ if (~keyIndex) {
14014
+ i = transitions.indexOf(t);
14015
+ transitions[i] = react_spring_core_esm_extends({}, t, {
14016
+ item: items[keyIndex]
14017
+ });
14018
+ } else if (leave) {
14019
+ transitions.splice(++i, 0, t);
14020
  }
 
 
 
14021
  });
14022
+ }
14023
 
14024
+ if (is.fun(sort)) {
14025
+ transitions.sort((a, b) => sort(a.item, b.item));
14026
+ }
 
 
 
 
 
 
 
14027
 
14028
+ let delay = -trail;
14029
+ const forceUpdate = useForceUpdate();
14030
+ const defaultProps = getDefaultProps(props);
14031
+ const changes = new Map();
14032
+ each(transitions, (t, i) => {
14033
+ const key = t.key;
14034
+ const prevPhase = t.phase;
14035
+ const p = propsFn ? propsFn() : props;
14036
+ let to;
14037
+ let phase;
14038
+ let propsDelay = callProp(p.delay || 0, key);
 
 
 
 
 
14039
 
14040
+ if (prevPhase == TransitionPhase.MOUNT) {
14041
+ to = p.enter;
14042
+ phase = TransitionPhase.ENTER;
14043
+ } else {
14044
+ const isLeave = keys.indexOf(key) < 0;
14045
 
14046
+ if (prevPhase != TransitionPhase.LEAVE) {
14047
+ if (isLeave) {
14048
+ to = p.leave;
14049
+ phase = TransitionPhase.LEAVE;
14050
+ } else if (to = p.update) {
14051
+ phase = TransitionPhase.UPDATE;
14052
+ } else return;
14053
+ } else if (!isLeave) {
14054
+ to = p.enter;
14055
+ phase = TransitionPhase.ENTER;
14056
+ } else return;
14057
+ }
14058
 
14059
+ to = callProp(to, t.item, i);
14060
+ to = is.obj(to) ? inferTo(to) : {
14061
+ to
14062
+ };
14063
 
14064
+ if (!to.config) {
14065
+ const config = propsConfig || defaultProps.config;
14066
+ to.config = callProp(config, t.item, i, phase);
14067
+ }
14068
 
14069
+ delay += trail;
14070
 
14071
+ const payload = react_spring_core_esm_extends({}, defaultProps, {
14072
+ delay: propsDelay + delay,
14073
+ ref: propsRef,
14074
+ immediate: p.immediate,
14075
+ reset: false
14076
+ }, to);
14077
 
14078
+ if (phase == TransitionPhase.ENTER && is.und(payload.from)) {
14079
+ const _p = propsFn ? propsFn() : props;
14080
 
14081
+ const from = is.und(_p.initial) || prevTransitions ? _p.from : _p.initial;
14082
+ payload.from = callProp(from, t.item, i);
14083
+ }
14084
 
14085
+ const {
14086
+ onResolve
14087
+ } = payload;
14088
 
14089
+ payload.onResolve = result => {
14090
+ callProp(onResolve, result);
14091
+ const transitions = usedTransitions.current;
14092
+ const t = transitions.find(t => t.key === key);
14093
+ if (!t) return;
14094
 
14095
+ if (result.cancelled && t.phase != TransitionPhase.UPDATE) {
14096
+ return;
14097
+ }
 
 
 
 
 
 
 
14098
 
14099
+ if (t.ctrl.idle) {
14100
+ const idle = transitions.every(t => t.ctrl.idle);
 
 
 
 
14101
 
14102
+ if (t.phase == TransitionPhase.LEAVE) {
14103
+ const expiry = callProp(expires, t.item);
 
14104
 
14105
+ if (expiry !== false) {
14106
+ const expiryMs = expiry === true ? 0 : expiry;
14107
+ t.expired = true;
14108
 
14109
+ if (!idle && expiryMs > 0) {
14110
+ if (expiryMs <= 0x7fffffff) t.expirationId = setTimeout(forceUpdate, expiryMs);
14111
+ return;
14112
+ }
14113
+ }
14114
+ }
14115
 
14116
+ if (idle && transitions.some(t => t.expired)) {
14117
+ forceUpdate();
 
 
14118
  }
14119
  }
14120
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14121
 
14122
+ const springs = getSprings(t.ctrl, payload);
14123
+ changes.set(t, {
14124
+ phase,
14125
+ springs,
14126
+ payload
14127
+ });
14128
+ });
14129
+ const context = useContext(SpringContext);
14130
+ const prevContext = usePrev(context);
14131
+ const hasContext = context !== prevContext && hasProps(context);
14132
+ useLayoutEffect(() => {
14133
+ if (hasContext) each(transitions, t => {
14134
+ t.ctrl.start({
14135
+ default: context
14136
+ });
14137
+ });
14138
+ }, [context]);
14139
+ useLayoutEffect(() => {
14140
+ each(changes, ({
14141
+ phase,
14142
+ payload
14143
+ }, t) => {
14144
+ const {
14145
+ ctrl
14146
+ } = t;
14147
+ t.phase = phase;
14148
+ ref == null ? void 0 : ref.add(ctrl);
14149
 
14150
+ if (hasContext && phase == TransitionPhase.ENTER) {
14151
+ ctrl.start({
14152
+ default: context
14153
+ });
14154
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
14155
 
14156
+ if (payload) {
14157
+ replaceRef(ctrl, payload.ref);
14158
 
14159
+ if (ctrl.ref) {
14160
+ ctrl.update(payload);
14161
+ } else {
14162
+ ctrl.start(payload);
14163
+ }
14164
+ }
14165
+ });
14166
+ }, reset ? void 0 : deps);
14167
 
14168
+ const renderTransitions = render => React.createElement(React.Fragment, null, transitions.map((t, i) => {
14169
+ const {
14170
+ springs
14171
+ } = changes.get(t) || t.ctrl;
14172
+ const elem = render(react_spring_core_esm_extends({}, springs), t.item, t, i);
14173
+ return elem && elem.type ? React.createElement(elem.type, react_spring_core_esm_extends({}, elem.props, {
14174
+ key: is.str(t.key) || is.num(t.key) ? t.key : t.ctrl.id,
14175
+ ref: elem.ref
14176
+ })) : elem;
14177
+ }));
14178
 
14179
+ return ref ? [renderTransitions, ref] : renderTransitions;
14180
  }
14181
+ let nextKey = 1;
 
 
 
 
 
 
 
 
 
14182
 
14183
+ function getKeys(items, {
14184
+ key,
14185
+ keys = key
14186
+ }, prevTransitions) {
14187
+ if (keys === null) {
14188
+ const reused = new Set();
14189
+ return items.map(item => {
14190
+ const t = prevTransitions && prevTransitions.find(t => t.item === item && t.phase !== TransitionPhase.LEAVE && !reused.has(t));
14191
 
14192
+ if (t) {
14193
+ reused.add(t);
14194
+ return t.key;
14195
+ }
14196
+
14197
+ return nextKey++;
14198
+ });
14199
  }
14200
 
14201
+ return is.und(keys) ? items : is.fun(keys) ? items.map(keys) : toArray(keys);
14202
  }
 
 
 
14203
 
14204
+ const _excluded$2 = (/* unused pure expression or super */ null && (["children"]));
14205
+ function Spring(_ref) {
14206
+ let {
14207
+ children
14208
+ } = _ref,
14209
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
14210
 
14211
+ return children(useSpring(props));
14212
+ }
 
14213
 
14214
+ const _excluded$1 = (/* unused pure expression or super */ null && (["items", "children"]));
14215
+ function Trail(_ref) {
14216
+ let {
14217
+ items,
14218
+ children
14219
+ } = _ref,
14220
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
14221
 
14222
+ const trails = useTrail(items.length, props);
14223
+ return items.map((item, index) => {
14224
+ const result = children(item, index);
14225
+ return is.fun(result) ? result(trails[index]) : result;
14226
+ });
14227
+ }
14228
 
14229
+ const _excluded = (/* unused pure expression or super */ null && (["items", "children"]));
14230
+ function Transition(_ref) {
14231
+ let {
14232
+ items,
14233
+ children
14234
+ } = _ref,
14235
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
14236
 
14237
+ return useTransition(items, props)(children);
14238
+ }
14239
 
14240
+ class Interpolation extends FrameValue {
14241
+ constructor(source, args) {
14242
+ super();
14243
+ this.key = void 0;
14244
+ this.idle = true;
14245
+ this.calc = void 0;
14246
+ this._active = new Set();
14247
+ this.source = source;
14248
+ this.calc = createInterpolator(...args);
14249
 
14250
+ const value = this._get();
 
 
14251
 
14252
+ const nodeType = getAnimatedType(value);
14253
+ setAnimated(this, nodeType.create(value));
14254
+ }
14255
 
14256
+ advance(_dt) {
14257
+ const value = this._get();
14258
 
14259
+ const oldValue = this.get();
14260
 
14261
+ if (!isEqual(value, oldValue)) {
14262
+ getAnimated(this).setValue(value);
14263
 
14264
+ this._onChange(value, this.idle);
14265
+ }
14266
 
14267
+ if (!this.idle && checkIdle(this._active)) {
14268
+ becomeIdle(this);
14269
+ }
14270
+ }
14271
 
14272
+ _get() {
14273
+ const inputs = react_spring_shared_esm_is.arr(this.source) ? this.source.map(getFluidValue) : react_spring_shared_esm_toArray(getFluidValue(this.source));
14274
+ return this.calc(...inputs);
14275
+ }
14276
 
14277
+ _start() {
14278
+ if (this.idle && !checkIdle(this._active)) {
14279
+ this.idle = false;
14280
+ react_spring_shared_esm_each(getPayload(this), node => {
14281
+ node.done = false;
14282
+ });
14283
 
14284
+ if (globals.skipAnimation) {
14285
+ raf.batchedUpdates(() => this.advance());
14286
+ becomeIdle(this);
14287
+ } else {
14288
+ frameLoop.start(this);
14289
+ }
14290
+ }
14291
  }
14292
 
14293
+ _attach() {
14294
+ let priority = 1;
14295
+ react_spring_shared_esm_each(react_spring_shared_esm_toArray(this.source), source => {
14296
+ if (hasFluidValue(source)) {
14297
+ addFluidObserver(source, this);
14298
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14299
 
14300
+ if (isFrameValue(source)) {
14301
+ if (!source.idle) {
14302
+ this._active.add(source);
14303
+ }
14304
 
14305
+ priority = Math.max(priority, source.priority + 1);
 
 
 
 
 
14306
  }
14307
+ });
14308
+ this.priority = priority;
 
 
 
 
 
 
14309
 
14310
+ this._start();
14311
+ }
 
14312
 
14313
+ _detach() {
14314
+ react_spring_shared_esm_each(react_spring_shared_esm_toArray(this.source), source => {
14315
+ if (hasFluidValue(source)) {
14316
+ removeFluidObserver(source, this);
14317
+ }
14318
+ });
 
 
 
 
14319
 
14320
+ this._active.clear();
14321
 
14322
+ becomeIdle(this);
14323
+ }
 
 
14324
 
14325
+ eventObserved(event) {
14326
+ if (event.type == 'change') {
14327
+ if (event.idle) {
14328
+ this.advance();
14329
+ } else {
14330
+ this._active.add(event.parent);
14331
 
14332
+ this._start();
 
 
 
14333
  }
14334
+ } else if (event.type == 'idle') {
14335
+ this._active.delete(event.parent);
14336
+ } else if (event.type == 'priority') {
14337
+ this.priority = react_spring_shared_esm_toArray(this.source).reduce((highest, parent) => Math.max(highest, (isFrameValue(parent) ? parent.priority : 0) + 1), 0);
14338
+ }
14339
  }
14340
 
 
14341
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14342
 
14343
+ function isIdle(source) {
14344
+ return source.idle !== false;
14345
+ }
 
14346
 
14347
+ function checkIdle(active) {
14348
+ return !active.size || Array.from(active).every(isIdle);
 
 
 
 
 
 
 
 
 
 
14349
  }
 
 
 
 
 
 
 
 
14350
 
14351
+ function becomeIdle(self) {
14352
+ if (!self.idle) {
14353
+ self.idle = true;
14354
+ react_spring_shared_esm_each(getPayload(self), node => {
14355
+ node.done = true;
14356
+ });
14357
+ callFluidObservers(self, {
14358
+ type: 'idle',
14359
+ parent: self
14360
+ });
14361
  }
14362
+ }
14363
 
14364
+ const react_spring_core_esm_to = (source, ...args) => new Interpolation(source, args);
14365
+ const react_spring_core_esm_interpolate = (source, ...args) => (deprecateInterpolate(), new Interpolation(source, args));
14366
 
14367
+ globals.assign({
14368
+ createStringInterpolator: createStringInterpolator,
14369
+ to: (source, args) => new Interpolation(source, args)
14370
+ });
14371
+ const react_spring_core_esm_update = frameLoop.advance;
14372
 
 
 
 
14373
 
 
 
14374
 
14375
+ ;// CONCATENATED MODULE: external "ReactDOM"
14376
+ var external_ReactDOM_namespaceObject = window["ReactDOM"];
14377
+ ;// CONCATENATED MODULE: ./node_modules/@react-spring/web/dist/react-spring-web.esm.js
 
 
 
 
 
 
 
14378
 
 
 
 
 
 
 
 
 
 
 
14379
 
 
 
14380
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14381
 
14382
 
 
 
 
14383
 
14384
+ function react_spring_web_esm_objectWithoutPropertiesLoose(source, excluded) {
14385
+ if (source == null) return {};
14386
+ var target = {};
14387
+ var sourceKeys = Object.keys(source);
14388
+ var key, i;
14389
 
14390
+ for (i = 0; i < sourceKeys.length; i++) {
14391
+ key = sourceKeys[i];
14392
+ if (excluded.indexOf(key) >= 0) continue;
14393
+ target[key] = source[key];
14394
+ }
14395
 
14396
+ return target;
14397
+ }
14398
 
14399
+ const react_spring_web_esm_excluded$2 = ["style", "children", "scrollTop", "scrollLeft"];
14400
+ const isCustomPropRE = /^--/;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14401
 
14402
+ function dangerousStyleValue(name, value) {
14403
+ if (value == null || typeof value === 'boolean' || value === '') return '';
14404
+ if (typeof value === 'number' && value !== 0 && !isCustomPropRE.test(name) && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) return value + 'px';
14405
+ return ('' + value).trim();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14406
  }
14407
 
14408
+ const attributeCache = {};
14409
+ function applyAnimatedValues(instance, props) {
14410
+ if (!instance.nodeType || !instance.setAttribute) {
14411
+ return false;
14412
+ }
14413
 
14414
+ const isFilterElement = instance.nodeName === 'filter' || instance.parentNode && instance.parentNode.nodeName === 'filter';
14415
 
14416
+ const _ref = props,
14417
+ {
14418
+ style,
14419
+ children,
14420
+ scrollTop,
14421
+ scrollLeft
14422
+ } = _ref,
14423
+ attributes = react_spring_web_esm_objectWithoutPropertiesLoose(_ref, react_spring_web_esm_excluded$2);
14424
 
14425
+ const values = Object.values(attributes);
14426
+ const names = Object.keys(attributes).map(name => isFilterElement || instance.hasAttribute(name) ? name : attributeCache[name] || (attributeCache[name] = name.replace(/([A-Z])/g, n => '-' + n.toLowerCase())));
14427
 
14428
+ if (children !== void 0) {
14429
+ instance.textContent = children;
14430
+ }
 
 
 
 
14431
 
14432
+ for (let name in style) {
14433
+ if (style.hasOwnProperty(name)) {
14434
+ const value = dangerousStyleValue(name, style[name]);
14435
 
14436
+ if (isCustomPropRE.test(name)) {
14437
+ instance.style.setProperty(name, value);
14438
+ } else {
14439
+ instance.style[name] = value;
14440
+ }
14441
+ }
14442
+ }
 
14443
 
14444
+ names.forEach((name, i) => {
14445
+ instance.setAttribute(name, values[i]);
 
 
 
 
 
 
 
 
 
14446
  });
 
 
 
 
 
14447
 
14448
+ if (scrollTop !== void 0) {
14449
+ instance.scrollTop = scrollTop;
14450
+ }
14451
 
14452
+ if (scrollLeft !== void 0) {
14453
+ instance.scrollLeft = scrollLeft;
14454
+ }
14455
+ }
14456
+ let isUnitlessNumber = {
14457
+ animationIterationCount: true,
14458
+ borderImageOutset: true,
14459
+ borderImageSlice: true,
14460
+ borderImageWidth: true,
14461
+ boxFlex: true,
14462
+ boxFlexGroup: true,
14463
+ boxOrdinalGroup: true,
14464
+ columnCount: true,
14465
+ columns: true,
14466
+ flex: true,
14467
+ flexGrow: true,
14468
+ flexPositive: true,
14469
+ flexShrink: true,
14470
+ flexNegative: true,
14471
+ flexOrder: true,
14472
+ gridRow: true,
14473
+ gridRowEnd: true,
14474
+ gridRowSpan: true,
14475
+ gridRowStart: true,
14476
+ gridColumn: true,
14477
+ gridColumnEnd: true,
14478
+ gridColumnSpan: true,
14479
+ gridColumnStart: true,
14480
+ fontWeight: true,
14481
+ lineClamp: true,
14482
+ lineHeight: true,
14483
+ opacity: true,
14484
+ order: true,
14485
+ orphans: true,
14486
+ tabSize: true,
14487
+ widows: true,
14488
+ zIndex: true,
14489
+ zoom: true,
14490
+ fillOpacity: true,
14491
+ floodOpacity: true,
14492
+ stopOpacity: true,
14493
+ strokeDasharray: true,
14494
+ strokeDashoffset: true,
14495
+ strokeMiterlimit: true,
14496
+ strokeOpacity: true,
14497
+ strokeWidth: true
14498
+ };
14499
 
14500
+ const prefixKey = (prefix, key) => prefix + key.charAt(0).toUpperCase() + key.substring(1);
14501
 
14502
+ const prefixes = ['Webkit', 'Ms', 'Moz', 'O'];
14503
+ isUnitlessNumber = Object.keys(isUnitlessNumber).reduce((acc, prop) => {
14504
+ prefixes.forEach(prefix => acc[prefixKey(prefix, prop)] = acc[prop]);
14505
+ return acc;
14506
+ }, isUnitlessNumber);
14507
 
14508
+ const react_spring_web_esm_excluded$1 = ["x", "y", "z"];
14509
+ const domTransforms = /^(matrix|translate|scale|rotate|skew)/;
14510
+ const pxTransforms = /^(translate)/;
14511
+ const degTransforms = /^(rotate|skew)/;
14512
 
14513
+ const addUnit = (value, unit) => react_spring_shared_esm_is.num(value) && value !== 0 ? value + unit : value;
14514
 
14515
+ const isValueIdentity = (value, id) => react_spring_shared_esm_is.arr(value) ? value.every(v => isValueIdentity(v, id)) : react_spring_shared_esm_is.num(value) ? value === id : parseFloat(value) === id;
14516
 
14517
+ class AnimatedStyle extends AnimatedObject {
14518
+ constructor(_ref) {
14519
+ let {
14520
+ x,
14521
+ y,
14522
+ z
14523
+ } = _ref,
14524
+ style = react_spring_web_esm_objectWithoutPropertiesLoose(_ref, react_spring_web_esm_excluded$1);
14525
 
14526
+ const inputs = [];
14527
+ const transforms = [];
14528
 
14529
+ if (x || y || z) {
14530
+ inputs.push([x || 0, y || 0, z || 0]);
14531
+ transforms.push(xyz => [`translate3d(${xyz.map(v => addUnit(v, 'px')).join(',')})`, isValueIdentity(xyz, 0)]);
14532
+ }
 
 
 
 
14533
 
14534
+ eachProp(style, (value, key) => {
14535
+ if (key === 'transform') {
14536
+ inputs.push([value || '']);
14537
+ transforms.push(transform => [transform, transform === '']);
14538
+ } else if (domTransforms.test(key)) {
14539
+ delete style[key];
14540
+ if (react_spring_shared_esm_is.und(value)) return;
14541
+ const unit = pxTransforms.test(key) ? 'px' : degTransforms.test(key) ? 'deg' : '';
14542
+ inputs.push(react_spring_shared_esm_toArray(value));
14543
+ transforms.push(key === 'rotate3d' ? ([x, y, z, deg]) => [`rotate3d(${x},${y},${z},${addUnit(deg, unit)})`, isValueIdentity(deg, 0)] : input => [`${key}(${input.map(v => addUnit(v, unit)).join(',')})`, isValueIdentity(input, key.startsWith('scale') ? 1 : 0)]);
14544
+ }
14545
+ });
14546
 
14547
+ if (inputs.length) {
14548
+ style.transform = new FluidTransform(inputs, transforms);
14549
+ }
14550
 
14551
+ super(style);
14552
+ }
 
 
 
14553
 
14554
+ }
14555
 
14556
+ class FluidTransform extends FluidValue {
14557
+ constructor(inputs, transforms) {
14558
+ super();
14559
+ this._value = null;
14560
+ this.inputs = inputs;
14561
+ this.transforms = transforms;
14562
+ }
14563
 
14564
+ get() {
14565
+ return this._value || (this._value = this._get());
14566
+ }
 
 
14567
 
14568
+ _get() {
14569
+ let transform = '';
14570
+ let identity = true;
14571
+ react_spring_shared_esm_each(this.inputs, (input, i) => {
14572
+ const arg1 = getFluidValue(input[0]);
14573
+ const [t, id] = this.transforms[i](react_spring_shared_esm_is.arr(arg1) ? arg1 : input.map(getFluidValue));
14574
+ transform += ' ' + t;
14575
+ identity = identity && id;
14576
+ });
14577
+ return identity ? 'none' : transform;
14578
+ }
14579
 
14580
+ observerAdded(count) {
14581
+ if (count == 1) react_spring_shared_esm_each(this.inputs, input => react_spring_shared_esm_each(input, value => hasFluidValue(value) && addFluidObserver(value, this)));
14582
+ }
 
 
 
 
 
 
 
14583
 
14584
+ observerRemoved(count) {
14585
+ if (count == 0) react_spring_shared_esm_each(this.inputs, input => react_spring_shared_esm_each(input, value => hasFluidValue(value) && removeFluidObserver(value, this)));
14586
+ }
14587
 
14588
+ eventObserved(event) {
14589
+ if (event.type == 'change') {
14590
+ this._value = null;
14591
+ }
14592
 
14593
+ callFluidObservers(this, event);
14594
+ }
 
14595
 
14596
+ }
14597
 
14598
+ const primitives = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', 'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan'];
14599
 
14600
+ const react_spring_web_esm_excluded = ["scrollTop", "scrollLeft"];
14601
+ globals.assign({
14602
+ batchedUpdates: external_ReactDOM_namespaceObject.unstable_batchedUpdates,
14603
+ createStringInterpolator: createStringInterpolator,
14604
+ colors: colors
14605
+ });
14606
+ const host = createHost(primitives, {
14607
+ applyAnimatedValues,
14608
+ createAnimatedStyle: style => new AnimatedStyle(style),
14609
+ getComponentProps: _ref => {
14610
+ let props = react_spring_web_esm_objectWithoutPropertiesLoose(_ref, react_spring_web_esm_excluded);
14611
 
14612
+ return props;
14613
+ }
14614
+ });
14615
+ const animated = host.animated;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14616
 
14617
 
14618
+
14619
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/use-moving-animation/index.js
14620
+ /**
14621
+ * External dependencies
14622
+ */
14623
+
14624
  /**
14625
  * WordPress dependencies
14626
  */
14627
 
14628
+
 
 
 
 
 
 
 
 
14629
 
14630
 
14631
  /**
14632
+ * Simple reducer used to increment a counter.
14633
+ *
14634
+ * @param {number} state Previous counter value.
14635
+ * @return {number} New state value.
14636
  */
14637
 
14638
+ const counterReducer = state => state + 1;
14639
+
14640
+ const getAbsolutePosition = element => {
14641
+ return {
14642
+ top: element.offsetTop,
14643
+ left: element.offsetLeft
14644
+ };
14645
+ };
14646
  /**
14647
+ * Hook used to compute the styles required to move a div into a new position.
14648
+ *
14649
+ * The way this animation works is the following:
14650
+ * - It first renders the element as if there was no animation.
14651
+ * - It takes a snapshot of the position of the block to use it
14652
+ * as a destination point for the animation.
14653
+ * - It restores the element to the previous position using a CSS transform
14654
+ * - It uses the "resetAnimation" flag to reset the animation
14655
+ * from the beginning in order to animate to the new destination point.
14656
+ *
14657
+ * @param {Object} $1 Options
14658
+ * @param {boolean} $1.isSelected Whether it's the current block or not.
14659
+ * @param {boolean} $1.adjustScrolling Adjust the scroll position to the current block.
14660
+ * @param {boolean} $1.enableAnimation Enable/Disable animation.
14661
+ * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.
14662
  */
14663
 
14664
 
14665
+ function useMovingAnimation({
14666
+ isSelected,
14667
+ adjustScrolling,
14668
+ enableAnimation,
14669
+ triggerAnimationOnChange
14670
+ }) {
14671
+ const ref = (0,external_wp_element_namespaceObject.useRef)();
14672
+ const prefersReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)() || !enableAnimation;
14673
+ const [triggeredAnimation, triggerAnimation] = (0,external_wp_element_namespaceObject.useReducer)(counterReducer, 0);
14674
+ const [finishedAnimation, endAnimation] = (0,external_wp_element_namespaceObject.useReducer)(counterReducer, 0);
14675
+ const [transform, setTransform] = (0,external_wp_element_namespaceObject.useState)({
14676
+ x: 0,
14677
+ y: 0
14678
+ });
14679
+ const previous = (0,external_wp_element_namespaceObject.useMemo)(() => ref.current ? getAbsolutePosition(ref.current) : null, [triggerAnimationOnChange]); // Calculate the previous position of the block relative to the viewport and
14680
+ // return a function to maintain that position by scrolling.
14681
+
14682
+ const preserveScrollPosition = (0,external_wp_element_namespaceObject.useMemo)(() => {
14683
+ if (!adjustScrolling || !ref.current) {
14684
+ return () => {};
14685
+ }
14686
+
14687
+ const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(ref.current);
14688
 
14689
+ if (!scrollContainer) {
14690
+ return () => {};
14691
+ }
14692
 
14693
+ const prevRect = ref.current.getBoundingClientRect();
14694
+ return () => {
14695
+ const blockRect = ref.current.getBoundingClientRect();
14696
+ const diff = blockRect.top - prevRect.top;
14697
 
14698
+ if (diff) {
14699
+ scrollContainer.scrollTop += diff;
14700
+ }
14701
+ };
14702
+ }, [triggerAnimationOnChange, adjustScrolling]);
14703
+ (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
14704
+ if (triggeredAnimation) {
14705
+ endAnimation();
14706
+ }
14707
+ }, [triggeredAnimation]);
14708
+ (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
14709
+ if (!previous) {
14710
+ return;
14711
+ }
14712
 
14713
+ if (prefersReducedMotion) {
14714
+ // if the animation is disabled and the scroll needs to be adjusted,
14715
+ // just move directly to the final scroll position.
14716
+ preserveScrollPosition();
14717
+ return;
14718
+ }
14719
+
14720
+ ref.current.style.transform = '';
14721
+ const destination = getAbsolutePosition(ref.current);
14722
+ triggerAnimation();
14723
+ setTransform({
14724
+ x: Math.round(previous.left - destination.left),
14725
+ y: Math.round(previous.top - destination.top)
14726
+ });
14727
+ }, [triggerAnimationOnChange]); // Only called when either the x or y value changes.
14728
+
14729
+ function onFrameChange({
14730
+ x,
14731
+ y
14732
+ }) {
14733
+ if (!ref.current) {
14734
+ return;
14735
+ }
14736
+
14737
+ const isMoving = x === 0 && y === 0;
14738
+ ref.current.style.transformOrigin = isMoving ? '' : 'center';
14739
+ ref.current.style.transform = isMoving ? '' : `translate3d(${x}px,${y}px,0)`;
14740
+ ref.current.style.zIndex = !isSelected || isMoving ? '' : '1';
14741
+ preserveScrollPosition();
14742
+ } // Called for every frame computed by useSpring.
14743
+
14744
+
14745
+ function onChange({
14746
+ value
14747
+ }) {
14748
+ let {
14749
+ x,
14750
+ y
14751
+ } = value;
14752
+ x = Math.round(x);
14753
+ y = Math.round(y);
14754
+
14755
+ if (x !== onChange.x || y !== onChange.y) {
14756
+ onFrameChange({
14757
+ x,
14758
+ y
14759
+ });
14760
+ onChange.x = x;
14761
+ onChange.y = y;
14762
+ }
14763
+ }
14764
+
14765
+ onChange.x = 0;
14766
+ onChange.y = 0;
14767
+ useSpring({
14768
+ from: {
14769
+ x: transform.x,
14770
+ y: transform.y
14771
  },
14772
+ to: {
14773
+ x: 0,
14774
+ y: 0
14775
+ },
14776
+ reset: triggeredAnimation !== finishedAnimation,
14777
+ config: {
14778
+ mass: 5,
14779
+ tension: 2000,
14780
+ friction: 200
14781
+ },
14782
+ immediate: prefersReducedMotion,
14783
+ onChange
14784
+ });
14785
+ return ref;
14786
  }
 
 
 
 
14787
 
14788
+ /* harmony default export */ var use_moving_animation = (useMovingAnimation);
14789
  //# sourceMappingURL=index.js.map
14790
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/dom.js
14791
+ const BLOCK_SELECTOR = '.block-editor-block-list__block';
14792
+ const APPENDER_SELECTOR = '.block-list-appender';
14793
+ /**
14794
+ * Returns true if two elements are contained within the same block.
14795
+ *
14796
+ * @param {Element} a First element.
14797
+ * @param {Element} b Second element.
14798
+ *
14799
+ * @return {boolean} Whether elements are in the same block.
14800
+ */
14801
 
14802
+ function isInSameBlock(a, b) {
14803
+ return a.closest(BLOCK_SELECTOR) === b.closest(BLOCK_SELECTOR);
14804
+ }
14805
+ /**
14806
+ * Returns true if an element is considered part of the block and not its inner
14807
+ * blocks or appender.
14808
+ *
14809
+ * @param {Element} blockElement Block container element.
14810
+ * @param {Element} element Element.
14811
+ *
14812
+ * @return {boolean} Whether an element is considered part of the block and not
14813
+ * its inner blocks or appender.
14814
+ */
14815
 
14816
+ function isInsideRootBlock(blockElement, element) {
14817
+ const parentBlock = element.closest([BLOCK_SELECTOR, APPENDER_SELECTOR].join(','));
14818
+ return parentBlock === blockElement;
14819
+ }
14820
  /**
14821
+ * Finds the block client ID given any DOM node inside the block.
14822
+ *
14823
+ * @param {Node?} node DOM node.
14824
+ *
14825
+ * @return {string|undefined} Client ID or undefined if the node is not part of
14826
+ * a block.
14827
  */
14828
 
14829
+ function getBlockClientId(node) {
14830
+ while (node && node.nodeType !== node.ELEMENT_NODE) {
14831
+ node = node.parentNode;
14832
+ }
14833
 
14834
+ if (!node) {
14835
+ return;
14836
+ }
14837
 
14838
+ const elementNode =
14839
+ /** @type {Element} */
14840
+ node;
14841
+ const blockNode = elementNode.closest(BLOCK_SELECTOR);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14842
 
14843
+ if (!blockNode) {
14844
+ return;
14845
+ }
14846
 
14847
+ return blockNode.id.slice('block-'.length);
14848
+ }
14849
+ //# sourceMappingURL=dom.js.map
14850
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-focus-first-element.js
14851
  /**
14852
  * External dependencies
14853
  */
14854
 
 
 
 
 
14855
  /**
14856
  * WordPress dependencies
14857
  */
14858
 
14859
 
14860
 
14861
+
14862
  /**
14863
  * Internal dependencies
14864
  */
14865
 
14866
 
14867
 
14868
+ /** @typedef {import('@wordpress/element').RefObject} RefObject */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14869
 
14870
+ /**
14871
+ * Returns the initial position if the block needs to be focussed, `undefined`
14872
+ * otherwise. The initial position is either 0 (start) or -1 (end).
14873
+ *
14874
+ * @param {string} clientId Block client ID.
14875
+ *
14876
+ * @return {number} The initial position, either 0 (start) or -1 (end).
14877
+ */
14878
 
14879
+ function useInitialPosition(clientId) {
14880
+ return (0,external_wp_data_namespaceObject.useSelect)(select => {
14881
+ const {
14882
+ getSelectedBlocksInitialCaretPosition,
14883
+ isMultiSelecting,
14884
+ isNavigationMode,
14885
+ isBlockSelected
14886
+ } = select(store);
14887
 
14888
+ if (!isBlockSelected(clientId)) {
14889
+ return;
14890
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14891
 
14892
+ if (isMultiSelecting() || isNavigationMode()) {
14893
+ return;
14894
+ } // If there's no initial position, return 0 to focus the start.
14895
 
14896
 
14897
+ return getSelectedBlocksInitialCaretPosition();
14898
+ }, [clientId]);
14899
+ }
14900
  /**
14901
+ * Transitions focus to the block or inner tabbable when the block becomes
14902
+ * selected and an initial position is set.
14903
+ *
14904
+ * @param {string} clientId Block client ID.
14905
+ *
14906
+ * @return {RefObject} React ref with the block element.
14907
  */
14908
 
14909
 
14910
+ function useFocusFirstElement(clientId) {
14911
+ const ref = (0,external_wp_element_namespaceObject.useRef)();
14912
+ const initialPosition = useInitialPosition(clientId);
14913
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
14914
+ if (initialPosition === undefined || initialPosition === null) {
14915
+ return;
14916
+ }
14917
+
14918
+ if (!ref.current) {
14919
+ return;
14920
+ }
14921
+
14922
+ const {
14923
+ ownerDocument
14924
+ } = ref.current; // Do not focus the block if it already contains the active element.
14925
+
14926
+ if (ref.current.contains(ownerDocument.activeElement)) {
14927
+ return;
14928
+ } // Find all tabbables within node.
14929
+
14930
+
14931
+ const textInputs = external_wp_dom_namespaceObject.focus.tabbable.find(ref.current).filter(node => (0,external_wp_dom_namespaceObject.isTextField)(node)); // If reversed (e.g. merge via backspace), use the last in the set of
14932
+ // tabbables.
14933
+
14934
+ const isReverse = -1 === initialPosition;
14935
+ const target = (isReverse ? external_lodash_namespaceObject.last : external_lodash_namespaceObject.first)(textInputs) || ref.current;
14936
 
14937
+ if (!isInsideRootBlock(ref.current, target)) {
14938
+ ref.current.focus();
14939
+ return;
14940
+ }
14941
 
14942
+ (0,external_wp_dom_namespaceObject.placeCaretAtHorizontalEdge)(target, isReverse);
14943
+ }, [initialPosition]);
14944
+ return ref;
14945
+ }
14946
+ //# sourceMappingURL=use-focus-first-element.js.map
14947
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-is-hovered.js
14948
+ /**
14949
+ * WordPress dependencies
14950
+ */
14951
 
14952
 
14953
  /**
14956
 
14957
 
14958
 
14959
+ function listener(event) {
14960
+ if (event.defaultPrevented) {
14961
+ return;
14962
+ }
14963
 
14964
+ const action = event.type === 'mouseover' ? 'add' : 'remove';
14965
+ event.preventDefault();
14966
+ event.currentTarget.classList[action]('is-hovered');
14967
+ }
14968
+ /**
14969
+ * Adds `is-hovered` class when the block is hovered and in navigation or
14970
+ * outline mode.
14971
+ */
 
 
 
14972
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14973
 
14974
+ function useIsHovered() {
14975
+ const isEnabled = (0,external_wp_data_namespaceObject.useSelect)(select => {
14976
+ const {
14977
+ isNavigationMode,
14978
+ getSettings
14979
+ } = select(store);
14980
+ return isNavigationMode() || getSettings().outlineMode;
14981
+ }, []);
14982
+ return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
14983
+ if (isEnabled) {
14984
+ node.addEventListener('mouseout', listener);
14985
+ node.addEventListener('mouseover', listener);
14986
+ return () => {
14987
+ node.removeEventListener('mouseout', listener);
14988
+ node.removeEventListener('mouseover', listener); // Remove class in case it lingers.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14989
 
14990
+ node.classList.remove('is-hovered');
14991
+ };
14992
  }
14993
+ }, [isEnabled]);
14994
+ }
14995
+ //# sourceMappingURL=use-is-hovered.js.map
14996
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-block-class-names.js
14997
+ /**
14998
+ * External dependencies
14999
+ */
15000
 
15001
  /**
15002
  * WordPress dependencies
15003
  */
15004
 
15005
+
15006
+
15007
  /**
15008
  * Internal dependencies
15009
  */
15010
 
15011
 
 
 
 
 
 
 
15012
  /**
15013
+ * Returns the class names used for the different states of the block.
15014
+ *
15015
+ * @param {string} clientId The block client ID.
15016
+ *
15017
+ * @return {string} The class names.
15018
  */
15019
 
15020
+ function useBlockClassNames(clientId) {
15021
+ return (0,external_wp_data_namespaceObject.useSelect)(select => {
15022
+ const {
15023
+ isBlockBeingDragged,
15024
+ isBlockHighlighted,
15025
+ isBlockSelected,
15026
+ isBlockMultiSelected,
15027
+ getBlockName,
15028
+ getSettings,
15029
+ hasSelectedInnerBlock,
15030
+ isTyping,
15031
+ __experimentalGetActiveBlockIdByBlockNames: getActiveBlockIdByBlockNames
15032
+ } = select(store);
15033
+ const {
15034
+ __experimentalSpotlightEntityBlocks: spotlightEntityBlocks,
15035
+ outlineMode
15036
+ } = getSettings();
15037
+ const isDragging = isBlockBeingDragged(clientId);
15038
+ const isSelected = isBlockSelected(clientId);
15039
+ const name = getBlockName(clientId);
15040
+ const checkDeep = true; // "ancestor" is the more appropriate label due to "deep" check
15041
 
15042
+ const isAncestorOfSelectedBlock = hasSelectedInnerBlock(clientId, checkDeep);
15043
+ const activeEntityBlockId = getActiveBlockIdByBlockNames(spotlightEntityBlocks);
15044
+ return classnames_default()({
15045
+ 'is-selected': isSelected,
15046
+ 'is-highlighted': isBlockHighlighted(clientId),
15047
+ 'is-multi-selected': isBlockMultiSelected(clientId),
15048
+ 'is-reusable': (0,external_wp_blocks_namespaceObject.isReusableBlock)((0,external_wp_blocks_namespaceObject.getBlockType)(name)),
15049
+ 'is-dragging': isDragging,
15050
+ 'has-child-selected': isAncestorOfSelectedBlock,
15051
+ 'has-active-entity': activeEntityBlockId,
15052
+ // Determine if there is an active entity area to spotlight.
15053
+ 'is-active-entity': activeEntityBlockId === clientId,
15054
+ 'remove-outline': isSelected && outlineMode && isTyping()
15055
  });
15056
+ }, [clientId]);
 
 
 
 
 
 
 
 
 
15057
  }
15058
+ //# sourceMappingURL=use-block-class-names.js.map
15059
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-block-default-class-name.js
 
 
 
 
 
 
 
 
 
 
15060
  /**
15061
  * WordPress dependencies
15062
  */
15063
 
15064
 
 
 
15065
  /**
15066
  * Internal dependencies
15067
  */
15068
 
15069
 
15070
+ /**
15071
+ * Returns the default class name if the block is a light block and it supports
15072
+ * `className`.
15073
+ *
15074
+ * @param {string} clientId The block client ID.
15075
+ *
15076
+ * @return {string} The class name, e.g. `wp-block-paragraph`.
15077
+ */
15078
 
15079
+ function useBlockDefaultClassName(clientId) {
15080
+ return (0,external_wp_data_namespaceObject.useSelect)(select => {
15081
+ const name = select(store).getBlockName(clientId);
15082
+ const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
15083
+ const hasLightBlockWrapper = (blockType === null || blockType === void 0 ? void 0 : blockType.apiVersion) > 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15084
 
15085
+ if (!hasLightBlockWrapper) {
15086
+ return;
 
 
15087
  }
 
15088
 
15089
+ return (0,external_wp_blocks_namespaceObject.getBlockDefaultClassName)(name);
15090
+ }, [clientId]);
 
 
 
 
 
 
 
15091
  }
15092
+ //# sourceMappingURL=use-block-default-class-name.js.map
15093
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-block-custom-class-name.js
15094
+ /**
15095
+ * WordPress dependencies
15096
+ */
15097
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15098
 
15099
+ /**
15100
+ * Internal dependencies
15101
+ */
15102
 
 
 
 
 
15103
 
15104
+ /**
15105
+ * Returns the custom class name if the block is a light block.
15106
+ *
15107
+ * @param {string} clientId The block client ID.
15108
+ *
15109
+ * @return {string} The custom class name.
15110
+ */
15111
 
15112
+ function useBlockCustomClassName(clientId) {
15113
+ // It's good for this to be a separate selector because it will be executed
15114
+ // on every attribute change, while the other selectors are not re-evaluated
15115
+ // as much.
15116
+ return (0,external_wp_data_namespaceObject.useSelect)(select => {
15117
+ const {
15118
+ getBlockName,
15119
+ getBlockAttributes
15120
+ } = select(store);
15121
+ const attributes = getBlockAttributes(clientId);
15122
 
15123
+ if (!(attributes !== null && attributes !== void 0 && attributes.className)) {
15124
+ return;
 
 
 
15125
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15126
 
15127
+ const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(getBlockName(clientId));
15128
+ const hasLightBlockWrapper = (blockType === null || blockType === void 0 ? void 0 : blockType.apiVersion) > 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15129
 
15130
+ if (!hasLightBlockWrapper) {
15131
+ return;
15132
  }
 
 
15133
 
15134
+ return attributes.className;
15135
+ }, [clientId]);
 
 
 
15136
  }
15137
+ //# sourceMappingURL=use-block-custom-class-name.js.map
15138
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-block-moving-mode-class-names.js
15139
+ /**
15140
+ * External dependencies
15141
+ */
15142
 
15143
+ /**
15144
+ * WordPress dependencies
15145
+ */
 
 
 
 
 
 
15146
 
 
 
 
 
 
 
15147
 
15148
+ /**
15149
+ * Internal dependencies
15150
+ */
 
 
 
 
 
15151
 
 
 
 
 
15152
 
15153
+ /**
15154
+ * Returns the class names used for block moving mode.
15155
+ *
15156
+ * @param {string} clientId The block client ID to insert above.
15157
+ *
15158
+ * @return {string} The class names.
15159
+ */
 
 
15160
 
15161
+ function useBlockMovingModeClassNames(clientId) {
15162
+ return (0,external_wp_data_namespaceObject.useSelect)(select => {
15163
+ const {
15164
+ hasBlockMovingClientId,
15165
+ canInsertBlockType,
15166
+ getBlockName,
15167
+ getBlockRootClientId,
15168
+ isBlockSelected
15169
+ } = select(store); // The classes are only relevant for the selected block. Avoid
15170
+ // re-rendering all blocks!
15171
 
15172
+ if (!isBlockSelected(clientId)) {
15173
+ return;
 
 
 
 
15174
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15175
 
15176
+ const movingClientId = hasBlockMovingClientId();
15177
 
15178
+ if (!movingClientId) {
15179
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15180
  }
15181
 
15182
+ return classnames_default()('is-block-moving-mode', {
15183
+ 'can-insert-moving-block': canInsertBlockType(getBlockName(movingClientId), getBlockRootClientId(clientId))
15184
+ });
15185
+ }, [clientId]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15186
  }
15187
+ //# sourceMappingURL=use-block-moving-mode-class-names.js.map
15188
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-focus-handler.js
15189
+ /**
15190
+ * WordPress dependencies
15191
+ */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15192
 
 
 
 
 
 
 
15193
 
15194
+ /**
15195
+ * Internal dependencies
15196
+ */
 
15197
 
 
15198
 
 
 
 
 
 
15199
 
15200
+ /**
15201
+ * Selects the block if it receives focus.
15202
+ *
15203
+ * @param {string} clientId Block client ID.
15204
+ */
 
 
15205
 
15206
+ function useFocusHandler(clientId) {
15207
+ const {
15208
+ isBlockSelected
15209
+ } = (0,external_wp_data_namespaceObject.useSelect)(store);
15210
+ const {
15211
+ selectBlock,
15212
+ selectionChange
15213
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
15214
+ return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
15215
+ /**
15216
+ * Marks the block as selected when focused and not already
15217
+ * selected. This specifically handles the case where block does not
15218
+ * set focus on its own (via `setFocus`), typically if there is no
15219
+ * focusable input in the block.
15220
+ *
15221
+ * @param {FocusEvent} event Focus event.
15222
+ */
15223
+ function onFocus(event) {
15224
+ // Check synchronously because a non-selected block might be
15225
+ // getting data through `useSelect` asynchronously.
15226
+ if (isBlockSelected(clientId)) {
15227
+ // Potentially change selection away from rich text.
15228
+ if (!event.target.isContentEditable) {
15229
+ selectionChange(clientId);
15230
+ }
15231
 
15232
+ return;
15233
+ } // If an inner block is focussed, that block is resposible for
15234
+ // setting the selected block.
15235
 
 
 
 
15236
 
15237
+ if (!isInsideRootBlock(node, event.target)) {
15238
+ return;
15239
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15240
 
15241
+ selectBlock(clientId);
15242
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15243
 
15244
+ node.addEventListener('focusin', onFocus);
15245
+ return () => {
15246
+ node.removeEventListener('focusin', onFocus);
15247
+ };
15248
+ }, [isBlockSelected, selectBlock]);
 
 
 
 
15249
  }
15250
+ //# sourceMappingURL=use-focus-handler.js.map
15251
+ ;// CONCATENATED MODULE: external ["wp","keycodes"]
15252
+ var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
15253
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js
15254
+ /**
15255
+ * WordPress dependencies
15256
+ */
15257
 
 
 
 
 
 
 
 
 
 
 
 
 
15258
 
 
 
 
15259
 
 
 
 
 
 
15260
 
15261
+ /**
15262
+ * Internal dependencies
15263
+ */
15264
 
 
 
 
 
 
15265
 
15266
+ /**
15267
+ * Adds block behaviour:
15268
+ * - Removes the block on BACKSPACE.
15269
+ * - Inserts a default block on ENTER.
15270
+ * - Disables dragging of block contents.
15271
+ *
15272
+ * @param {string} clientId Block client ID.
15273
+ */
15274
 
15275
+ function useEventHandlers(clientId) {
15276
+ const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isBlockSelected(clientId), [clientId]);
15277
+ const {
15278
+ getBlockRootClientId,
15279
+ getBlockIndex
15280
+ } = (0,external_wp_data_namespaceObject.useSelect)(store);
15281
+ const {
15282
+ insertDefaultBlock,
15283
+ removeBlock
15284
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
15285
+ return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
15286
+ if (!isSelected) {
15287
+ return;
15288
+ }
15289
+ /**
15290
+ * Interprets keydown event intent to remove or insert after block if
15291
+ * key event occurs on wrapper node. This can occur when the block has
15292
+ * no text fields of its own, particularly after initial insertion, to
15293
+ * allow for easy deletion and continuous writing flow to add additional
15294
+ * content.
15295
+ *
15296
+ * @param {KeyboardEvent} event Keydown event.
15297
+ */
15298
 
 
 
 
15299
 
15300
+ function onKeyDown(event) {
15301
+ const {
15302
+ keyCode,
15303
+ target
15304
+ } = event;
 
 
15305
 
15306
+ if (keyCode !== external_wp_keycodes_namespaceObject.ENTER && keyCode !== external_wp_keycodes_namespaceObject.BACKSPACE && keyCode !== external_wp_keycodes_namespaceObject.DELETE) {
15307
+ return;
15308
+ }
15309
 
15310
+ if (target !== node || (0,external_wp_dom_namespaceObject.isTextField)(target)) {
15311
+ return;
15312
+ }
15313
 
15314
+ event.preventDefault();
 
 
 
15315
 
15316
+ if (keyCode === external_wp_keycodes_namespaceObject.ENTER) {
15317
+ insertDefaultBlock({}, getBlockRootClientId(clientId), getBlockIndex(clientId) + 1);
15318
+ } else {
15319
+ removeBlock(clientId);
15320
  }
15321
  }
15322
+ /**
15323
+ * Prevents default dragging behavior within a block. To do: we must
15324
+ * handle this in the future and clean up the drag target.
15325
+ *
15326
+ * @param {DragEvent} event Drag event.
15327
+ */
15328
 
 
 
15329
 
15330
+ function onDragStart(event) {
15331
+ event.preventDefault();
15332
+ }
15333
+
15334
+ node.addEventListener('keydown', onKeyDown);
15335
+ node.addEventListener('dragstart', onDragStart);
15336
+ return () => {
15337
+ node.removeEventListener('keydown', onKeyDown);
15338
+ node.removeEventListener('dragstart', onDragStart);
15339
+ };
15340
+ }, [clientId, isSelected, getBlockRootClientId, getBlockIndex, insertDefaultBlock, removeBlock]);
15341
  }
15342
+ //# sourceMappingURL=use-selected-block-event-handlers.js.map
15343
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-nav-mode-exit.js
15344
+ /**
15345
+ * WordPress dependencies
15346
+ */
15347
 
 
 
15348
 
15349
+ /**
15350
+ * Internal dependencies
15351
+ */
15352
 
 
15353
 
15354
+ /**
15355
+ * Allows navigation mode to be exited by clicking in the selected block.
15356
+ *
15357
+ * @param {string} clientId Block client ID.
15358
+ */
15359
 
15360
+ function useNavModeExit(clientId) {
15361
+ const {
15362
+ isNavigationMode,
15363
+ isBlockSelected
15364
+ } = (0,external_wp_data_namespaceObject.useSelect)(store);
15365
+ const {
15366
+ setNavigationMode,
15367
+ selectBlock
15368
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
15369
+ return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
15370
+ function onMouseDown(event) {
15371
+ // Don't select a block if it's already handled by a child
15372
+ // block.
15373
+ if (isNavigationMode() && !event.defaultPrevented) {
15374
+ // Prevent focus from moving to the block.
15375
+ event.preventDefault(); // When clicking on a selected block, exit navigation mode.
15376
 
15377
+ if (isBlockSelected(clientId)) {
15378
+ setNavigationMode(false);
15379
+ } else {
15380
+ selectBlock(clientId);
15381
+ }
15382
+ }
15383
+ }
15384
 
15385
+ node.addEventListener('mousedown', onMouseDown);
15386
+ return () => {
15387
+ node.addEventListener('mousedown', onMouseDown);
15388
+ };
15389
+ }, [clientId, isNavigationMode, isBlockSelected, setNavigationMode]);
15390
  }
15391
+ //# sourceMappingURL=use-nav-mode-exit.js.map
15392
+ // EXTERNAL MODULE: ./node_modules/dom-scroll-into-view/lib/index.js
15393
+ var dom_scroll_into_view_lib = __webpack_require__(4979);
15394
+ var lib_default = /*#__PURE__*/__webpack_require__.n(dom_scroll_into_view_lib);
15395
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-scroll-into-view.js
15396
+ /**
15397
+ * External dependencies
15398
+ */
15399
 
15400
+ /**
15401
+ * WordPress dependencies
15402
+ */
 
15403
 
15404
+ /**
15405
+ * WordPress dependencies
15406
+ */
15407
 
 
 
15408
 
 
15409
 
 
15410
 
15411
+ /**
15412
+ * Internal dependencies
15413
+ */
15414
 
 
 
 
15415
 
15416
+ function useScrollIntoView(clientId) {
15417
+ const ref = (0,external_wp_element_namespaceObject.useRef)();
15418
+ const isSelectionEnd = (0,external_wp_data_namespaceObject.useSelect)(select => {
15419
+ const {
15420
+ isBlockSelected,
15421
+ getBlockSelectionEnd
15422
+ } = select(store);
15423
+ return isBlockSelected(clientId) || getBlockSelectionEnd() === clientId;
15424
+ }, [clientId]); // Note that we can't use `useRefEffect` here, since an element change does
15425
+ // not mean we can scroll. `isSelectionEnd` should be the sole dependency,
15426
+ // while with `useRefEffect`, the element is a dependency as well.
15427
 
15428
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
15429
+ if (!isSelectionEnd) {
15430
+ return;
15431
  }
 
15432
 
15433
+ const extentNode = ref.current;
 
15434
 
15435
+ if (!extentNode) {
15436
+ return;
15437
+ } // If the block is focused, the browser will already have scrolled into
15438
+ // view if necessary.
15439
 
 
 
15440
 
15441
+ if (extentNode.contains(extentNode.ownerDocument.activeElement)) {
15442
+ return;
 
 
15443
  }
15444
 
15445
+ const scrollContainer = (0,external_wp_dom_namespaceObject.getScrollContainer)(extentNode) || extentNode.ownerDocument.defaultView; // If there's no scroll container, it follows that there's no scrollbar
15446
+ // and thus there's no need to try to scroll into view.
 
 
 
15447
 
15448
+ if (!scrollContainer) {
15449
+ return;
15450
+ }
 
 
15451
 
15452
+ lib_default()(extentNode, scrollContainer, {
15453
+ onlyScrollIfNeeded: true
15454
+ });
15455
+ }, [isSelectionEnd]);
15456
+ return ref;
15457
+ }
15458
+ //# sourceMappingURL=use-scroll-into-view.js.map
15459
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/provider/block-refs-provider.js
15460
 
 
15461
 
15462
+ /**
15463
+ * WordPress dependencies
15464
+ */
 
 
 
 
 
15465
 
15466
+ const BlockRefs = (0,external_wp_element_namespaceObject.createContext)();
15467
+ function BlockRefsProvider({
15468
+ children
15469
+ }) {
15470
+ const value = (0,external_wp_element_namespaceObject.useMemo)(() => ({
15471
+ refs: new Map(),
15472
+ callbacks: new Map()
15473
+ }), []);
15474
+ return (0,external_wp_element_namespaceObject.createElement)(BlockRefs.Provider, {
15475
+ value: value
15476
+ }, children);
15477
+ }
15478
+ //# sourceMappingURL=block-refs-provider.js.map
15479
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-block-refs.js
15480
+ /**
15481
+ * WordPress dependencies
15482
+ */
15483
 
 
15484
 
15485
+ /**
15486
+ * Internal dependencies
15487
+ */
15488
 
 
 
 
15489
 
15490
+ /** @typedef {import('@wordpress/element').RefCallback} RefCallback */
 
 
 
 
 
 
15491
 
15492
+ /** @typedef {import('@wordpress/element').RefObject} RefObject */
 
 
 
 
 
 
 
15493
 
15494
+ /**
15495
+ * Provides a ref to the BlockRefs context.
15496
+ *
15497
+ * @param {string} clientId The client ID of the element ref.
15498
+ *
15499
+ * @return {RefCallback} Ref callback.
15500
+ */
15501
 
15502
+ function useBlockRefProvider(clientId) {
15503
+ const {
15504
+ refs,
15505
+ callbacks
15506
+ } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs);
15507
+ const ref = (0,external_wp_element_namespaceObject.useRef)();
15508
+ (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
15509
+ refs.set(ref, clientId);
15510
+ return () => {
15511
+ refs.delete(ref);
15512
+ };
15513
+ }, [clientId]);
15514
+ return (0,external_wp_compose_namespaceObject.useRefEffect)(element => {
15515
+ // Update the ref in the provider.
15516
+ ref.current = element; // Call any update functions.
15517
 
15518
+ callbacks.forEach((id, setElement) => {
15519
+ if (clientId === id) {
15520
+ setElement(element);
15521
+ }
15522
+ });
15523
+ }, [clientId]);
 
 
 
15524
  }
15525
+ /**
15526
+ * Gets a ref pointing to the current block element. Continues to return a
15527
+ * stable ref even if the block client ID changes.
15528
+ *
15529
+ * @param {string} clientId The client ID to get a ref for.
15530
+ *
15531
+ * @return {RefObject} A ref containing the element.
15532
+ */
15533
 
15534
+ function useBlockRef(clientId) {
15535
+ const {
15536
+ refs
15537
+ } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs);
15538
+ const freshClientId = (0,external_wp_element_namespaceObject.useRef)();
15539
+ freshClientId.current = clientId; // Always return an object, even if no ref exists for a given client ID, so
15540
+ // that `current` works at a later point.
 
 
15541
 
15542
+ return (0,external_wp_element_namespaceObject.useMemo)(() => ({
15543
+ get current() {
15544
+ let element = null; // Multiple refs may be created for a single block. Find the
15545
+ // first that has an element set.
 
 
 
 
15546
 
15547
+ for (const [ref, id] of refs.entries()) {
15548
+ if (id === freshClientId.current && ref.current) {
15549
+ element = ref.current;
15550
+ }
15551
+ }
15552
 
15553
+ return element;
 
 
 
 
15554
  }
 
 
 
 
 
 
15555
 
15556
+ }), []);
 
 
 
 
15557
  }
15558
+ /**
15559
+ * Return the element for a given client ID. Updates whenever the element
15560
+ * changes, becomes available, or disappears.
15561
+ *
15562
+ * @param {string} clientId The client ID to an element for.
15563
+ *
15564
+ * @return {Element|null} The block's wrapper element.
15565
+ */
15566
 
 
 
 
 
15567
 
15568
+ function useBlockElement(clientId) {
15569
+ const {
15570
+ callbacks
15571
+ } = (0,external_wp_element_namespaceObject.useContext)(BlockRefs);
15572
+ const ref = useBlockRef(clientId);
15573
+ const [element, setElement] = (0,external_wp_element_namespaceObject.useState)(null);
15574
+ (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
15575
+ if (!clientId) {
15576
+ return;
15577
  }
 
 
 
 
15578
 
15579
+ callbacks.set(setElement, clientId);
15580
+ return () => {
15581
+ callbacks.delete(setElement);
15582
+ };
15583
+ }, [clientId]);
15584
+ return ref.current || element;
15585
  }
15586
 
 
 
15587
 
15588
 
15589
+ //# sourceMappingURL=use-block-refs.js.map
15590
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-multi-selection.js
15591
+ /**
15592
+ * WordPress dependencies
15593
+ */
15594
 
15595
 
15596
+ /**
15597
+ * Internal dependencies
15598
+ */
15599
 
15600
 
 
 
 
 
 
 
 
 
 
 
15601
 
 
 
 
15602
 
15603
+ function toggleRichText(container, toggle) {
15604
+ Array.from(container.closest('.is-root-container').querySelectorAll('.rich-text')).forEach(node => {
15605
+ if (toggle) {
15606
+ node.setAttribute('contenteditable', true);
15607
+ } else {
15608
+ node.removeAttribute('contenteditable');
15609
+ }
15610
+ });
15611
  }
15612
+ /**
15613
+ * Sets a multi-selection based on the native selection across blocks.
15614
+ *
15615
+ * @param {string} clientId Block client ID.
15616
+ */
15617
 
 
 
 
 
 
 
 
 
 
 
15618
 
15619
+ function useMultiSelection(clientId) {
15620
+ const {
15621
+ startMultiSelect,
15622
+ stopMultiSelect,
15623
+ multiSelect,
15624
+ selectBlock
15625
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
15626
+ const {
15627
+ isSelectionEnabled,
15628
+ isBlockSelected,
15629
+ getBlockParents,
15630
+ getBlockSelectionStart,
15631
+ hasMultiSelection
15632
+ } = (0,external_wp_data_namespaceObject.useSelect)(store);
15633
+ return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
15634
+ const {
15635
+ ownerDocument
15636
+ } = node;
15637
+ const {
15638
+ defaultView
15639
+ } = ownerDocument;
15640
+ let anchorElement;
15641
+ let rafId;
15642
 
15643
+ function onSelectionChange({
15644
+ isSelectionEnd
15645
+ }) {
15646
+ const selection = defaultView.getSelection(); // If no selection is found, end multi selection and enable all rich
15647
+ // text areas.
15648
 
15649
+ if (!selection.rangeCount || selection.isCollapsed) {
15650
+ toggleRichText(node, true);
15651
+ return;
15652
+ }
15653
 
15654
+ const endClientId = getBlockClientId(selection.focusNode);
15655
+ const isSingularSelection = clientId === endClientId;
 
15656
 
15657
+ if (isSingularSelection) {
15658
+ selectBlock(clientId); // If the selection is complete (on mouse up), and no
15659
+ // multiple blocks have been selected, set focus back to the
15660
+ // anchor element. if the anchor element contains the
15661
+ // selection. Additionally, rich text elements that were
15662
+ // previously disabled can now be enabled again.
15663
 
15664
+ if (isSelectionEnd) {
15665
+ toggleRichText(node, true);
15666
 
15667
+ if (selection.rangeCount) {
15668
+ const {
15669
+ commonAncestorContainer
15670
+ } = selection.getRangeAt(0);
15671
+
15672
+ if (anchorElement.contains(commonAncestorContainer)) {
15673
+ anchorElement.focus();
15674
+ }
15675
+ }
15676
  }
15677
+ } else {
15678
+ const startPath = [...getBlockParents(clientId), clientId];
15679
+ const endPath = [...getBlockParents(endClientId), endClientId];
15680
+ const depth = Math.min(startPath.length, endPath.length) - 1;
15681
+ multiSelect(startPath[depth], endPath[depth]);
15682
  }
15683
  }
15684
 
15685
+ function onSelectionEnd() {
15686
+ ownerDocument.removeEventListener('selectionchange', onSelectionChange); // Equivalent to attaching the listener once.
 
 
 
 
 
15687
 
15688
+ defaultView.removeEventListener('mouseup', onSelectionEnd); // The browser selection won't have updated yet at this point,
15689
+ // so wait until the next animation frame to get the browser
15690
+ // selection.
 
 
15691
 
15692
+ rafId = defaultView.requestAnimationFrame(() => {
15693
+ onSelectionChange({
15694
+ isSelectionEnd: true
15695
+ });
15696
+ stopMultiSelect();
15697
+ });
15698
  }
 
15699
 
15700
+ function onMouseLeave({
15701
+ buttons
15702
+ }) {
15703
+ // The primary button must be pressed to initiate selection.
15704
+ // See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons
15705
+ if (buttons !== 1) {
15706
+ return;
15707
+ }
15708
 
15709
+ if (!isSelectionEnabled() || !isBlockSelected(clientId)) {
15710
+ return;
15711
+ }
 
 
 
 
 
 
15712
 
15713
+ anchorElement = ownerDocument.activeElement;
15714
+ startMultiSelect(); // `onSelectionStart` is called after `mousedown` and
15715
+ // `mouseleave` (from a block). The selection ends when
15716
+ // `mouseup` happens anywhere in the window.
15717
 
15718
+ ownerDocument.addEventListener('selectionchange', onSelectionChange);
15719
+ defaultView.addEventListener('mouseup', onSelectionEnd); // Removing the contenteditable attributes within the block
15720
+ // editor is essential for selection to work across editable
15721
+ // areas. The edible hosts are removed, allowing selection to be
15722
+ // extended outside the DOM element. `startMultiSelect` sets a
15723
+ // flag in the store so the rich text components are updated,
15724
+ // but the rerender may happen very slowly, especially in Safari
15725
+ // for the blocks that are asynchonously rendered. To ensure the
15726
+ // browser instantly removes the selection boundaries, we remove
15727
+ // the contenteditable attributes manually.
15728
 
15729
+ toggleRichText(node, false);
15730
+ }
15731
+
15732
+ function onMouseDown(event) {
15733
+ // The main button.
15734
+ // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
15735
+ if (!isSelectionEnabled() || event.button !== 0) {
15736
+ return;
15737
  }
15738
 
15739
+ if (event.shiftKey) {
15740
+ const blockSelectionStart = getBlockSelectionStart(); // By checking `blockSelectionStart` to be set, we handle the
15741
+ // case where we select a single block. We also have to check
15742
+ // the selectionEnd (clientId) not to be included in the
15743
+ // `blockSelectionStart`'s parents because the click event is
15744
+ // propagated.
 
15745
 
15746
+ const startParents = getBlockParents(blockSelectionStart);
 
15747
 
15748
+ if (blockSelectionStart && blockSelectionStart !== clientId && !(startParents !== null && startParents !== void 0 && startParents.includes(clientId))) {
15749
+ toggleRichText(node, false);
15750
+ const startPath = [...startParents, blockSelectionStart];
15751
+ const endPath = [...getBlockParents(clientId), clientId];
15752
+ const depth = Math.min(startPath.length, endPath.length) - 1;
15753
+ multiSelect(startPath[depth], endPath[depth]);
15754
+ event.preventDefault();
15755
+ }
15756
+ } else if (hasMultiSelection()) {
15757
+ // Allow user to escape out of a multi-selection to a
15758
+ // singular selection of a block via click. This is handled
15759
+ // here since focus handling excludes blocks when there is
15760
+ // multiselection, as focus can be incurred by starting a
15761
+ // multiselection (focus moved to first block's multi-
15762
+ // controls).
15763
+ selectBlock(clientId);
15764
+ }
15765
  }
15766
 
15767
+ node.addEventListener('mousedown', onMouseDown);
15768
+ node.addEventListener('mouseleave', onMouseLeave);
15769
+ return () => {
15770
+ node.removeEventListener('mousedown', onMouseDown);
15771
+ node.removeEventListener('mouseleave', onMouseLeave);
15772
+ ownerDocument.removeEventListener('selectionchange', onSelectionChange);
15773
+ defaultView.removeEventListener('mouseup', onSelectionEnd);
15774
+ defaultView.cancelAnimationFrame(rafId);
15775
+ };
15776
+ }, [clientId, startMultiSelect, stopMultiSelect, multiSelect, selectBlock, isSelectionEnabled, isBlockSelected, getBlockParents]);
15777
+ }
15778
+ //# sourceMappingURL=use-multi-selection.js.map
15779
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/use-intersection-observer.js
15780
+ /**
15781
+ * WordPress dependencies
15782
+ */
15783
+
15784
+
15785
+ /**
15786
+ * Internal dependencies
15787
+ */
15788
 
15789
+
15790
+ function useIntersectionObserver() {
15791
+ const observer = (0,external_wp_element_namespaceObject.useContext)(IntersectionObserver);
15792
+ return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
15793
+ if (observer) {
15794
+ observer.observe(node);
15795
+ return () => {
15796
+ observer.unobserve(node);
15797
+ };
15798
+ }
15799
+ }, [observer]);
15800
  }
15801
+ //# sourceMappingURL=use-intersection-observer.js.map
15802
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-block-props/index.js
15803
+ /**
15804
+ * External dependencies
15805
+ */
15806
 
15807
+ /**
15808
+ * WordPress dependencies
15809
+ */
15810
 
 
 
 
 
 
 
15811
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15812
 
 
 
 
 
15813
 
 
 
 
 
 
15814
 
 
 
 
 
 
 
 
15815
 
 
 
 
 
15816
 
15817
+ /**
15818
+ * Internal dependencies
15819
+ */
15820
 
 
 
 
 
15821
 
 
15822
 
 
 
 
 
15823
 
 
 
 
15824
 
 
 
 
15825
 
 
 
15826
 
 
 
 
15827
 
 
 
 
15828
 
 
15829
 
 
 
 
 
15830
 
 
 
 
 
15831
 
 
 
 
 
15832
 
 
 
 
 
 
 
15833
 
 
 
15834
 
 
 
15835
 
 
 
 
 
 
 
 
 
 
15836
 
 
 
15837
 
15838
+ /**
15839
+ * If the block count exceeds the threshold, we disable the reordering animation
15840
+ * to avoid laginess.
15841
+ */
15842
 
15843
+ const BLOCK_ANIMATION_THRESHOLD = 200;
15844
+ /**
15845
+ * This hook is used to lightly mark an element as a block element. The element
15846
+ * should be the outermost element of a block. Call this hook and pass the
15847
+ * returned props to the element to mark as a block. If you define a ref for the
15848
+ * element, it is important to pass the ref to this hook, which the hook in turn
15849
+ * will pass to the component through the props it returns. Optionally, you can
15850
+ * also pass any other props through this hook, and they will be merged and
15851
+ * returned.
15852
+ *
15853
+ * @param {Object} props Optional. Props to pass to the element. Must contain
15854
+ * the ref if one is defined.
15855
+ * @param {Object} options Options for internal use only.
15856
+ * @param {boolean} options.__unstableIsHtml
15857
+ *
15858
+ * @return {Object} Props to pass to the element to mark as a block.
15859
+ */
15860
 
15861
+ function useBlockProps(props = {}, {
15862
+ __unstableIsHtml
15863
+ } = {}) {
15864
+ const {
15865
+ clientId,
15866
+ className,
15867
+ wrapperProps = {},
15868
+ isAligned
15869
+ } = (0,external_wp_element_namespaceObject.useContext)(BlockListBlockContext);
15870
+ const {
15871
+ index,
15872
+ mode,
15873
+ name,
15874
+ blockApiVersion,
15875
+ blockTitle,
15876
+ isPartOfSelection,
15877
+ adjustScrolling,
15878
+ enableAnimation
15879
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
15880
+ const {
15881
+ getBlockRootClientId,
15882
+ getBlockIndex,
15883
+ getBlockMode,
15884
+ getBlockName,
15885
+ isTyping,
15886
+ getGlobalBlockCount,
15887
+ isBlockSelected,
15888
+ isBlockMultiSelected,
15889
+ isAncestorMultiSelected,
15890
+ isFirstMultiSelectedBlock
15891
+ } = select(store);
15892
+ const isSelected = isBlockSelected(clientId);
15893
+ const isPartOfMultiSelection = isBlockMultiSelected(clientId) || isAncestorMultiSelected(clientId);
15894
+ const blockName = getBlockName(clientId);
15895
+ const rootClientId = getBlockRootClientId(clientId);
15896
+ const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName);
15897
+ return {
15898
+ index: getBlockIndex(clientId, rootClientId),
15899
+ mode: getBlockMode(clientId),
15900
+ name: blockName,
15901
+ blockApiVersion: (blockType === null || blockType === void 0 ? void 0 : blockType.apiVersion) || 1,
15902
+ blockTitle: blockType === null || blockType === void 0 ? void 0 : blockType.title,
15903
+ isPartOfSelection: isSelected || isPartOfMultiSelection,
15904
+ adjustScrolling: isSelected || isFirstMultiSelectedBlock(clientId),
15905
+ enableAnimation: !isTyping() && getGlobalBlockCount() <= BLOCK_ANIMATION_THRESHOLD
15906
  };
15907
+ }, [clientId]); // translators: %s: Type of block (i.e. Text, Image etc)
15908
 
15909
+ const blockLabel = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Block: %s'), blockTitle);
15910
+ const htmlSuffix = mode === 'html' && !__unstableIsHtml ? '-visual' : '';
15911
+ const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([props.ref, useFocusFirstElement(clientId), // Must happen after focus because we check for focus in the block.
15912
+ useScrollIntoView(clientId), useBlockRefProvider(clientId), useFocusHandler(clientId), useMultiSelection(clientId), useEventHandlers(clientId), useNavModeExit(clientId), useIsHovered(), useIntersectionObserver(), use_moving_animation({
15913
+ isSelected: isPartOfSelection,
15914
+ adjustScrolling,
15915
+ enableAnimation,
15916
+ triggerAnimationOnChange: index
15917
+ })]);
15918
+ const blockEditContext = useBlockEditContext(); // Ensures it warns only inside the `edit` implementation for the block.
 
 
 
 
 
 
 
 
 
 
 
 
 
15919
 
15920
+ if (blockApiVersion < 2 && clientId === blockEditContext.clientId) {
15921
+ typeof process !== "undefined" && process.env && "production" !== "production" ? external_wp_warning_default()(`Block type "${name}" must support API version 2 or higher to work correctly with "useBlockProps" method.`) : void 0;
 
 
15922
  }
15923
 
15924
+ return { ...wrapperProps,
15925
+ ...props,
15926
+ ref: mergedRefs,
15927
+ id: `block-${clientId}${htmlSuffix}`,
15928
+ tabIndex: 0,
15929
+ role: 'document',
15930
+ 'aria-label': blockLabel,
15931
+ 'data-block': clientId,
15932
+ 'data-type': name,
15933
+ 'data-title': blockTitle,
15934
+ className: classnames_default()( // The wp-block className is important for editor styles.
15935
+ classnames_default()('block-editor-block-list__block', {
15936
+ 'wp-block': !isAligned
15937
+ }), className, props.className, wrapperProps.className, useBlockClassNames(clientId), useBlockDefaultClassName(clientId), useBlockCustomClassName(clientId), useBlockMovingModeClassNames(clientId)),
15938
+ style: { ...wrapperProps.style,
15939
+ ...props.style
15940
  }
15941
+ };
 
15942
  }
15943
+ /**
15944
+ * Call within a save function to get the props for the block wrapper.
15945
+ *
15946
+ * @param {Object} props Optional. Props to pass to the element.
15947
+ */
15948
 
15949
+ useBlockProps.save = external_wp_blocks_namespaceObject.__unstableGetBlockProps;
15950
+ //# sourceMappingURL=index.js.map
15951
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/block.js
 
 
 
 
 
 
 
15952
 
 
 
 
 
15953
 
15954
+ /**
15955
+ * External dependencies
15956
+ */
15957
 
 
 
 
 
 
 
 
 
 
 
 
15958
 
15959
+ /**
15960
+ * WordPress dependencies
15961
+ */
15962
 
 
 
 
 
 
15963
 
 
 
 
15964
 
 
 
 
 
15965
 
 
 
 
 
 
 
15966
 
 
15967
 
15968
 
15969
+ /**
15970
+ * Internal dependencies
15971
+ */
15972
 
 
15973
 
15974
 
15975
 
15977
 
15978
 
15979
 
15980
+ const BlockListBlockContext = (0,external_wp_element_namespaceObject.createContext)();
15981
+ /**
15982
+ * Merges wrapper props with special handling for classNames and styles.
15983
+ *
15984
+ * @param {Object} propsA
15985
+ * @param {Object} propsB
15986
+ *
15987
+ * @return {Object} Merged props.
15988
+ */
15989
 
15990
+ function mergeWrapperProps(propsA, propsB) {
15991
+ const newProps = { ...propsA,
15992
+ ...propsB
15993
+ };
15994
 
15995
+ if (propsA && propsB && propsA.className && propsB.className) {
15996
+ newProps.className = classnames_default()(propsA.className, propsB.className);
15997
+ }
 
 
 
15998
 
15999
+ if (propsA && propsB && propsA.style && propsB.style) {
16000
+ newProps.style = { ...propsA.style,
16001
+ ...propsB.style
16002
+ };
16003
+ }
16004
 
16005
+ return newProps;
16006
  }
16007
 
16008
+ function Block({
16009
+ children,
16010
+ isHtml,
16011
+ ...props
16012
+ }) {
16013
+ return (0,external_wp_element_namespaceObject.createElement)("div", useBlockProps(props, {
16014
+ __unstableIsHtml: isHtml
16015
+ }), children);
16016
  }
 
 
 
16017
 
16018
+ function BlockListBlock({
16019
+ mode,
16020
+ isLocked,
16021
+ canRemove,
16022
+ clientId,
16023
+ isSelected,
16024
+ isSelectionEnabled,
16025
+ className,
16026
+ name,
16027
+ isValid,
16028
+ attributes,
16029
+ wrapperProps,
16030
+ setAttributes,
16031
+ onReplace,
16032
+ onInsertBlocksAfter,
16033
+ onMerge,
16034
+ toggleSelection
16035
+ }) {
16036
+ const {
16037
+ removeBlock
16038
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
16039
+ const onRemove = (0,external_wp_element_namespaceObject.useCallback)(() => removeBlock(clientId), [clientId]); // We wrap the BlockEdit component in a div that hides it when editing in
16040
+ // HTML mode. This allows us to render all of the ancillary pieces
16041
+ // (InspectorControls, etc.) which are inside `BlockEdit` but not
16042
+ // `BlockHTML`, even in HTML mode.
16043
 
16044
+ let blockEdit = (0,external_wp_element_namespaceObject.createElement)(BlockEdit, {
16045
+ name: name,
16046
+ isSelected: isSelected,
16047
+ attributes: attributes,
16048
+ setAttributes: setAttributes,
16049
+ insertBlocksAfter: isLocked ? undefined : onInsertBlocksAfter,
16050
+ onReplace: canRemove ? onReplace : undefined,
16051
+ onRemove: canRemove ? onRemove : undefined,
16052
+ mergeBlocks: canRemove ? onMerge : undefined,
16053
+ clientId: clientId,
16054
+ isSelectionEnabled: isSelectionEnabled,
16055
+ toggleSelection: toggleSelection
16056
+ });
16057
+ const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name); // Determine whether the block has props to apply to the wrapper.
16058
 
16059
+ if (blockType !== null && blockType !== void 0 && blockType.getEditWrapperProps) {
16060
+ wrapperProps = mergeWrapperProps(wrapperProps, blockType.getEditWrapperProps(attributes));
 
16061
  }
16062
 
16063
+ const isAligned = wrapperProps && !!wrapperProps['data-align']; // For aligned blocks, provide a wrapper element so the block can be
16064
+ // positioned relative to the block column.
 
 
16065
 
16066
+ if (isAligned) {
16067
+ blockEdit = (0,external_wp_element_namespaceObject.createElement)("div", {
16068
+ className: "wp-block",
16069
+ "data-align": wrapperProps['data-align']
16070
+ }, blockEdit);
16071
  }
16072
 
16073
+ let block;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16074
 
16075
+ if (!isValid) {
16076
+ const saveContent = (0,external_wp_blocks_namespaceObject.getSaveContent)(blockType, attributes);
16077
+ block = (0,external_wp_element_namespaceObject.createElement)(Block, {
16078
+ className: "has-warning"
16079
+ }, (0,external_wp_element_namespaceObject.createElement)(block_invalid_warning, {
16080
+ clientId: clientId
16081
+ }), (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, (0,external_wp_dom_namespaceObject.safeHTML)(saveContent)));
16082
+ } else if (mode === 'html') {
16083
+ // Render blockEdit so the inspector controls don't disappear.
16084
+ // See #8969.
16085
+ block = (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
16086
+ style: {
16087
+ display: 'none'
16088
+ }
16089
+ }, blockEdit), (0,external_wp_element_namespaceObject.createElement)(Block, {
16090
+ isHtml: true
16091
+ }, (0,external_wp_element_namespaceObject.createElement)(block_html, {
16092
+ clientId: clientId
16093
+ })));
16094
+ } else if ((blockType === null || blockType === void 0 ? void 0 : blockType.apiVersion) > 1) {
16095
+ block = blockEdit;
16096
+ } else {
16097
+ block = (0,external_wp_element_namespaceObject.createElement)(Block, wrapperProps, blockEdit);
16098
  }
16099
+
16100
+ const value = {
16101
+ clientId,
16102
+ className,
16103
+ wrapperProps: (0,external_lodash_namespaceObject.omit)(wrapperProps, ['data-align']),
16104
+ isAligned
16105
+ };
16106
+ const memoizedValue = (0,external_wp_element_namespaceObject.useMemo)(() => value, Object.values(value));
16107
+ return (0,external_wp_element_namespaceObject.createElement)(BlockListBlockContext.Provider, {
16108
+ value: memoizedValue
16109
+ }, (0,external_wp_element_namespaceObject.createElement)(block_crash_boundary, {
16110
+ fallback: (0,external_wp_element_namespaceObject.createElement)(Block, {
16111
+ className: "has-warning"
16112
+ }, (0,external_wp_element_namespaceObject.createElement)(block_crash_warning, null))
16113
+ }, block));
16114
  }
16115
 
16116
+ const applyWithSelect = (0,external_wp_data_namespaceObject.withSelect)((select, {
16117
+ clientId,
16118
+ rootClientId
16119
+ }) => {
16120
+ const {
16121
+ isBlockSelected,
16122
+ getBlockMode,
16123
+ isSelectionEnabled,
16124
+ getTemplateLock,
16125
+ __unstableGetBlockWithoutInnerBlocks,
16126
+ canRemoveBlock,
16127
+ canMoveBlock
16128
+ } = select(store);
16129
 
16130
+ const block = __unstableGetBlockWithoutInnerBlocks(clientId);
 
 
 
 
 
 
16131
 
16132
+ const isSelected = isBlockSelected(clientId);
16133
+ const templateLock = getTemplateLock(rootClientId);
16134
+ const canRemove = canRemoveBlock(clientId, rootClientId);
16135
+ const canMove = canMoveBlock(clientId, rootClientId); // The fallback to `{}` is a temporary fix.
16136
+ // This function should never be called when a block is not present in
16137
+ // the state. It happens now because the order in withSelect rendering
16138
+ // is not correct.
 
 
 
 
16139
 
16140
+ const {
16141
+ name,
16142
+ attributes,
16143
+ isValid
16144
+ } = block || {}; // Do not add new properties here, use `useSelect` instead to avoid
16145
+ // leaking new props to the public API (editor.BlockListBlock filter).
 
16146
 
16147
+ return {
16148
+ mode: getBlockMode(clientId),
16149
+ isSelectionEnabled: isSelectionEnabled(),
16150
+ isLocked: !!templateLock,
16151
+ canRemove,
16152
+ canMove,
16153
+ // Users of the editor.BlockListBlock filter used to be able to
16154
+ // access the block prop.
16155
+ // Ideally these blocks would rely on the clientId prop only.
16156
+ // This is kept for backward compatibility reasons.
16157
+ block,
16158
+ name,
16159
+ attributes,
16160
+ isValid,
16161
+ isSelected
16162
+ };
16163
+ });
16164
+ const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps, {
16165
+ select
16166
+ }) => {
16167
+ const {
16168
+ updateBlockAttributes,
16169
+ insertBlocks,
16170
+ mergeBlocks,
16171
+ replaceBlocks,
16172
+ toggleSelection,
16173
+ __unstableMarkLastChangeAsPersistent
16174
+ } = dispatch(store); // Do not add new properties here, use `useDispatch` instead to avoid
16175
+ // leaking new props to the public API (editor.BlockListBlock filter).
16176
 
16177
+ return {
16178
+ setAttributes(newAttributes) {
16179
+ const {
16180
+ getMultiSelectedBlockClientIds
16181
+ } = select(store);
16182
+ const multiSelectedBlockClientIds = getMultiSelectedBlockClientIds();
16183
+ const {
16184
+ clientId
16185
+ } = ownProps;
16186
+ const clientIds = multiSelectedBlockClientIds.length ? multiSelectedBlockClientIds : [clientId];
16187
+ updateBlockAttributes(clientIds, newAttributes);
16188
+ },
16189
 
16190
+ onInsertBlocks(blocks, index) {
16191
+ const {
16192
+ rootClientId
16193
+ } = ownProps;
16194
+ insertBlocks(blocks, index, rootClientId);
16195
+ },
16196
 
16197
+ onInsertBlocksAfter(blocks) {
16198
+ const {
16199
+ clientId,
16200
+ rootClientId
16201
+ } = ownProps;
16202
+ const {
16203
+ getBlockIndex
16204
+ } = select(store);
16205
+ const index = getBlockIndex(clientId, rootClientId);
16206
+ insertBlocks(blocks, index + 1, rootClientId);
16207
+ },
16208
 
16209
+ onMerge(forward) {
16210
+ const {
16211
+ clientId
16212
+ } = ownProps;
16213
+ const {
16214
+ getPreviousBlockClientId,
16215
+ getNextBlockClientId
16216
+ } = select(store);
16217
+
16218
+ if (forward) {
16219
+ const nextBlockClientId = getNextBlockClientId(clientId);
16220
+
16221
+ if (nextBlockClientId) {
16222
+ mergeBlocks(clientId, nextBlockClientId);
16223
  }
16224
+ } else {
16225
+ const previousBlockClientId = getPreviousBlockClientId(clientId);
 
 
 
16226
 
16227
+ if (previousBlockClientId) {
16228
+ mergeBlocks(previousBlockClientId, clientId);
 
 
 
 
 
 
 
 
16229
  }
16230
+ }
16231
+ },
16232
+
16233
+ onReplace(blocks, indexToSelect, initialPosition) {
16234
+ if (blocks.length && !(0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(blocks[blocks.length - 1])) {
16235
+ __unstableMarkLastChangeAsPersistent();
16236
+ }
16237
+
16238
+ replaceBlocks([ownProps.clientId], blocks, indexToSelect, initialPosition);
16239
+ },
16240
+
16241
+ toggleSelection(selectionEnabled) {
16242
+ toggleSelection(selectionEnabled);
16243
  }
 
 
16244
 
16245
+ };
16246
+ });
16247
+ /* harmony default export */ var block = ((0,external_wp_compose_namespaceObject.compose)(external_wp_compose_namespaceObject.pure, applyWithSelect, applyWithDispatch, // block is sometimes not mounted at the right time, causing it be undefined
16248
+ // see issue for more info
16249
+ // https://github.com/WordPress/gutenberg/issues/17013
16250
+ (0,external_wp_compose_namespaceObject.ifCondition)(({
16251
+ block
16252
+ }) => !!block), (0,external_wp_components_namespaceObject.withFilters)('editor.BlockListBlock'))(BlockListBlock));
16253
+ //# sourceMappingURL=block.js.map
16254
+ ;// CONCATENATED MODULE: external ["wp","htmlEntities"]
16255
+ var external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
16256
+ ;// CONCATENATED MODULE: ./packages/icons/build-module/library/plus.js
16257
+
16258
+
16259
+ /**
16260
+ * WordPress dependencies
16261
+ */
16262
+
16263
+ const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
16264
+ xmlns: "http://www.w3.org/2000/svg",
16265
+ viewBox: "0 0 24 24"
16266
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
16267
+ d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"
16268
+ }));
16269
+ /* harmony default export */ var library_plus = (plus);
16270
+ //# sourceMappingURL=plus.js.map
16271
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/tips.js
16272
+
16273
+
16274
+ /**
16275
+ * WordPress dependencies
16276
+ */
16277
 
 
16278
 
 
 
 
 
 
 
16279
 
16280
+ const globalTips = [(0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('While writing, you can press <kbd>/</kbd> to quickly insert new blocks.'), {
16281
+ kbd: (0,external_wp_element_namespaceObject.createElement)("kbd", null)
16282
+ }), (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Indent a list by pressing <kbd>space</kbd> at the beginning of a line.'), {
16283
+ kbd: (0,external_wp_element_namespaceObject.createElement)("kbd", null)
16284
+ }), (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Outdent a list by pressing <kbd>backspace</kbd> at the beginning of a line.'), {
16285
+ kbd: (0,external_wp_element_namespaceObject.createElement)("kbd", null)
16286
+ }), (0,external_wp_i18n_namespaceObject.__)('Drag files into the editor to automatically insert media blocks.'), (0,external_wp_i18n_namespaceObject.__)("Change a block's type by pressing the block icon on the toolbar.")];
 
 
 
 
 
 
 
 
 
 
 
 
16287
 
16288
+ function Tips() {
16289
+ const [randomIndex] = (0,external_wp_element_namespaceObject.useState)( // Disable Reason: I'm not generating an HTML id.
16290
+ // eslint-disable-next-line no-restricted-syntax
16291
+ Math.floor(Math.random() * globalTips.length));
16292
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Tip, null, globalTips[randomIndex]);
16293
  }
 
 
 
 
 
 
16294
 
16295
+ /* harmony default export */ var tips = (Tips);
16296
+ //# sourceMappingURL=tips.js.map
16297
+ ;// CONCATENATED MODULE: ./packages/icons/build-module/library/block-default.js
16298
 
 
 
 
 
 
16299
 
16300
+ /**
16301
+ * WordPress dependencies
16302
+ */
 
 
16303
 
16304
+ const blockDefault = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
16305
+ xmlns: "http://www.w3.org/2000/svg",
16306
+ viewBox: "0 0 24 24"
16307
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
16308
+ d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z"
16309
+ }));
16310
+ /* harmony default export */ var block_default = (blockDefault);
16311
+ //# sourceMappingURL=block-default.js.map
16312
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-icon/index.js
16313
 
 
 
16314
 
16315
+ /**
16316
+ * External dependencies
16317
+ */
 
 
16318
 
16319
+ /**
16320
+ * WordPress dependencies
16321
+ */
 
16322
 
 
 
 
 
 
16323
 
16324
+
16325
+ function BlockIcon({
16326
+ icon,
16327
+ showColors = false,
16328
+ className
16329
+ }) {
16330
+ var _icon;
16331
+
16332
+ if (((_icon = icon) === null || _icon === void 0 ? void 0 : _icon.src) === 'block-default') {
16333
+ icon = {
16334
+ src: block_default
16335
+ };
16336
  }
16337
 
16338
+ const renderedIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
16339
+ icon: icon && icon.src ? icon.src : icon
16340
+ });
16341
+ const style = showColors ? {
16342
+ backgroundColor: icon && icon.background,
16343
+ color: icon && icon.foreground
16344
+ } : {};
16345
+ return (0,external_wp_element_namespaceObject.createElement)("span", {
16346
+ style: style,
16347
+ className: classnames_default()('block-editor-block-icon', className, {
16348
+ 'has-colors': showColors
16349
+ })
16350
+ }, renderedIcon);
16351
  }
16352
+ //# sourceMappingURL=index.js.map
16353
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-card/index.js
16354
 
 
 
 
 
 
 
 
 
 
16355
 
16356
+ /**
16357
+ * WordPress dependencies
16358
+ */
16359
 
16360
+ /**
16361
+ * Internal dependencies
16362
+ */
 
 
 
16363
 
 
16364
 
 
 
 
16365
 
16366
+ function BlockCard({
16367
+ title,
16368
+ icon,
16369
+ description,
16370
+ blockType
16371
+ }) {
16372
+ if (blockType) {
16373
+ external_wp_deprecated_default()('`blockType` property in `BlockCard component`', {
16374
+ since: '5.7',
16375
+ alternative: '`title, icon and description` properties'
16376
+ });
16377
+ ({
16378
+ title,
16379
+ icon,
16380
+ description
16381
+ } = blockType);
16382
+ }
16383
 
16384
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
16385
+ className: "block-editor-block-card"
16386
+ }, (0,external_wp_element_namespaceObject.createElement)(BlockIcon, {
16387
+ icon: icon,
16388
+ showColors: true
16389
+ }), (0,external_wp_element_namespaceObject.createElement)("div", {
16390
+ className: "block-editor-block-card__content"
16391
+ }, (0,external_wp_element_namespaceObject.createElement)("h2", {
16392
+ className: "block-editor-block-card__title"
16393
+ }, title), (0,external_wp_element_namespaceObject.createElement)("span", {
16394
+ className: "block-editor-block-card__description"
16395
+ }, description)));
16396
+ }
16397
 
16398
+ /* harmony default export */ var block_card = (BlockCard);
16399
+ //# sourceMappingURL=index.js.map
16400
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/provider/with-registry-provider.js
 
 
 
16401
 
 
 
 
 
 
 
 
 
 
16402
 
 
 
 
16403
 
16404
+ /**
16405
+ * WordPress dependencies
16406
+ */
16407
 
 
 
 
 
 
 
 
 
 
 
 
16408
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16409
 
16410
+ /**
16411
+ * Internal dependencies
16412
+ */
 
 
 
 
 
 
 
16413
 
 
 
 
16414
 
 
 
 
 
 
 
 
16415
 
16416
+ const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => {
16417
+ return (0,external_wp_data_namespaceObject.withRegistry)(({
16418
+ useSubRegistry = true,
16419
+ registry,
16420
+ ...props
16421
+ }) => {
16422
+ if (!useSubRegistry) {
16423
+ return (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, _extends({
16424
+ registry: registry
16425
+ }, props));
16426
+ }
16427
 
16428
+ const [subRegistry, setSubRegistry] = (0,external_wp_element_namespaceObject.useState)(null);
16429
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
16430
+ const newRegistry = (0,external_wp_data_namespaceObject.createRegistry)({}, registry);
16431
+ newRegistry.registerStore(STORE_NAME, storeConfig);
16432
+ setSubRegistry(newRegistry);
16433
+ }, [registry]);
16434
 
16435
+ if (!subRegistry) {
16436
+ return null;
16437
+ }
 
 
 
 
 
 
 
16438
 
16439
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_data_namespaceObject.RegistryProvider, {
16440
+ value: subRegistry
16441
+ }, (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, _extends({
16442
+ registry: subRegistry
16443
+ }, props)));
16444
+ });
16445
+ }, 'withRegistryProvider');
16446
+ /* harmony default export */ var with_registry_provider = (withRegistryProvider);
16447
+ //# sourceMappingURL=with-registry-provider.js.map
16448
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/provider/use-block-sync.js
16449
+ /**
16450
+ * External dependencies
16451
+ */
16452
 
16453
+ /**
16454
+ * WordPress dependencies
16455
+ */
 
 
16456
 
 
 
 
16457
 
 
16458
 
 
 
 
 
16459
 
16460
+ /**
16461
+ * Internal dependencies
16462
+ */
16463
 
 
 
 
 
 
 
 
 
 
16464
 
16465
+ /**
16466
+ * A function to call when the block value has been updated in the block-editor
16467
+ * store.
16468
+ *
16469
+ * @callback onBlockUpdate
16470
+ * @param {Object[]} blocks The updated blocks.
16471
+ * @param {Object} options The updated block options, such as selectionStart
16472
+ * and selectionEnd.
16473
+ */
 
 
 
 
 
 
 
 
16474
 
16475
+ /**
16476
+ * useBlockSync is a side effect which handles bidirectional sync between the
16477
+ * block-editor store and a controlling data source which provides blocks. This
16478
+ * is most commonly used by the BlockEditorProvider to synchronize the contents
16479
+ * of the block-editor store with the root entity, like a post.
16480
+ *
16481
+ * Another example would be the template part block, which provides blocks from
16482
+ * a separate entity data source than a root entity. This hook syncs edits to
16483
+ * the template part in the block editor back to the entity and vice-versa.
16484
+ *
16485
+ * Here are some of its basic functions:
16486
+ * - Initalizes the block-editor store for the given clientID to the blocks
16487
+ * given via props.
16488
+ * - Adds incoming changes (like undo) to the block-editor store.
16489
+ * - Adds outgoing changes (like editing content) to the controlling entity,
16490
+ * determining if a change should be considered persistent or not.
16491
+ * - Handles edge cases and race conditions which occur in those operations.
16492
+ * - Ignores changes which happen to other entities (like nested inner block
16493
+ * controllers.
16494
+ * - Passes selection state from the block-editor store to the controlling entity.
16495
+ *
16496
+ * @param {Object} props Props for the block sync hook
16497
+ * @param {string} props.clientId The client ID of the inner block controller.
16498
+ * If none is passed, then it is assumed to be a
16499
+ * root controller rather than an inner block
16500
+ * controller.
16501
+ * @param {Object[]} props.value The control value for the blocks. This value
16502
+ * is used to initalize the block-editor store
16503
+ * and for resetting the blocks to incoming
16504
+ * changes like undo.
16505
+ * @param {Object} props.selection The selection state responsible to restore the selection on undo/redo.
16506
+ * @param {onBlockUpdate} props.onChange Function to call when a persistent
16507
+ * change has been made in the block-editor blocks
16508
+ * for the given clientId. For example, after
16509
+ * this function is called, an entity is marked
16510
+ * dirty because it has changes to save.
16511
+ * @param {onBlockUpdate} props.onInput Function to call when a non-persistent
16512
+ * change has been made in the block-editor blocks
16513
+ * for the given clientId. When this is called,
16514
+ * controlling sources do not become dirty.
16515
+ */
16516
 
16517
+ function useBlockSync({
16518
+ clientId = null,
16519
+ value: controlledBlocks,
16520
+ selection: controlledSelection,
16521
+ onChange = external_lodash_namespaceObject.noop,
16522
+ onInput = external_lodash_namespaceObject.noop
16523
+ }) {
16524
+ const registry = (0,external_wp_data_namespaceObject.useRegistry)();
16525
+ const {
16526
+ resetBlocks,
16527
+ resetSelection,
16528
+ replaceInnerBlocks,
16529
+ setHasControlledInnerBlocks,
16530
+ __unstableMarkNextChangeAsNotPersistent
16531
+ } = registry.dispatch(store);
16532
+ const {
16533
+ getBlockName,
16534
+ getBlocks
16535
+ } = registry.select(store);
16536
+ const pendingChanges = (0,external_wp_element_namespaceObject.useRef)({
16537
+ incoming: null,
16538
+ outgoing: []
16539
+ });
16540
+ const subscribed = (0,external_wp_element_namespaceObject.useRef)(false);
16541
 
16542
+ const setControlledBlocks = () => {
16543
+ if (!controlledBlocks) {
16544
+ return;
16545
+ } // We don't need to persist this change because we only replace
16546
+ // controlled inner blocks when the change was caused by an entity,
16547
+ // and so it would already be persisted.
16548
 
 
16549
 
16550
+ __unstableMarkNextChangeAsNotPersistent();
16551
+
16552
+ if (clientId) {
16553
+ setHasControlledInnerBlocks(clientId, true);
 
 
 
 
 
16554
 
16555
+ __unstableMarkNextChangeAsNotPersistent();
 
 
16556
 
16557
+ const storeBlocks = controlledBlocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block));
 
 
16558
 
16559
+ if (subscribed.current) {
16560
+ pendingChanges.current.incoming = storeBlocks;
16561
+ }
16562
+
16563
+ replaceInnerBlocks(clientId, storeBlocks);
16564
+ } else {
16565
+ if (subscribed.current) {
16566
+ pendingChanges.current.incoming = controlledBlocks;
16567
+ }
16568
+
16569
+ resetBlocks(controlledBlocks);
16570
  }
16571
+ }; // Add a subscription to the block-editor registry to detect when changes
16572
+ // have been made. This lets us inform the data source of changes. This
16573
+ // is an effect so that the subscriber can run synchronously without
16574
+ // waiting for React renders for changes.
16575
 
 
 
 
 
16576
 
16577
+ const onInputRef = (0,external_wp_element_namespaceObject.useRef)(onInput);
16578
+ const onChangeRef = (0,external_wp_element_namespaceObject.useRef)(onChange);
16579
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
16580
+ onInputRef.current = onInput;
16581
+ onChangeRef.current = onChange;
16582
+ }, [onInput, onChange]); // Determine if blocks need to be reset when they change.
16583
 
16584
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
16585
+ if (pendingChanges.current.outgoing.includes(controlledBlocks)) {
16586
+ // Skip block reset if the value matches expected outbound sync
16587
+ // triggered by this component by a preceding change detection.
16588
+ // Only skip if the value matches expectation, since a reset should
16589
+ // still occur if the value is modified (not equal by reference),
16590
+ // to allow that the consumer may apply modifications to reflect
16591
+ // back on the editor.
16592
+ if ((0,external_lodash_namespaceObject.last)(pendingChanges.current.outgoing) === controlledBlocks) {
16593
+ pendingChanges.current.outgoing = [];
16594
+ }
16595
+ } else if (getBlocks(clientId) !== controlledBlocks) {
16596
+ // Reset changing value in all other cases than the sync described
16597
+ // above. Since this can be reached in an update following an out-
16598
+ // bound sync, unset the outbound value to avoid considering it in
16599
+ // subsequent renders.
16600
+ pendingChanges.current.outgoing = [];
16601
+ setControlledBlocks();
16602
 
16603
+ if (controlledSelection) {
16604
+ resetSelection(controlledSelection.selectionStart, controlledSelection.selectionEnd, controlledSelection.initialPosition);
16605
+ }
16606
+ }
16607
+ }, [controlledBlocks, clientId]);
16608
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
16609
+ const {
16610
+ getSelectionStart,
16611
+ getSelectionEnd,
16612
+ getSelectedBlocksInitialCaretPosition,
16613
+ isLastBlockChangePersistent,
16614
+ __unstableIsLastBlockChangeIgnored
16615
+ } = registry.select(store);
16616
+ let blocks = getBlocks(clientId);
16617
+ let isPersistent = isLastBlockChangePersistent();
16618
+ let previousAreBlocksDifferent = false;
16619
+ subscribed.current = true;
16620
+ const unsubscribe = registry.subscribe(() => {
16621
+ // Sometimes, when changing block lists, lingering subscriptions
16622
+ // might trigger before they are cleaned up. If the block for which
16623
+ // the subscription runs is no longer in the store, this would clear
16624
+ // its parent entity's block list. To avoid this, we bail out if
16625
+ // the subscription is triggering for a block (`clientId !== null`)
16626
+ // and its block name can't be found because it's not on the list.
16627
+ // (`getBlockName( clientId ) === null`).
16628
+ if (clientId !== null && getBlockName(clientId) === null) return;
16629
+ const newIsPersistent = isLastBlockChangePersistent();
16630
+ const newBlocks = getBlocks(clientId);
16631
+ const areBlocksDifferent = newBlocks !== blocks;
16632
+ blocks = newBlocks;
16633
 
16634
+ if (areBlocksDifferent && (pendingChanges.current.incoming || __unstableIsLastBlockChangeIgnored())) {
16635
+ pendingChanges.current.incoming = null;
16636
+ isPersistent = newIsPersistent;
16637
+ return;
16638
+ } // Since we often dispatch an action to mark the previous action as
16639
+ // persistent, we need to make sure that the blocks changed on the
16640
+ // previous action before committing the change.
16641
 
 
 
 
16642
 
16643
+ const didPersistenceChange = previousAreBlocksDifferent && !areBlocksDifferent && newIsPersistent && !isPersistent;
16644
 
16645
+ if (areBlocksDifferent || didPersistenceChange) {
16646
+ isPersistent = newIsPersistent; // We know that onChange/onInput will update controlledBlocks.
16647
+ // We need to be aware that it was caused by an outgoing change
16648
+ // so that we do not treat it as an incoming change later on,
16649
+ // which would cause a block reset.
16650
 
16651
+ pendingChanges.current.outgoing.push(blocks); // Inform the controlling entity that changes have been made to
16652
+ // the block-editor store they should be aware about.
 
 
 
 
 
 
16653
 
16654
+ const updateParent = isPersistent ? onChangeRef.current : onInputRef.current;
16655
+ updateParent(blocks, {
16656
+ selection: {
16657
+ selectionStart: getSelectionStart(),
16658
+ selectionEnd: getSelectionEnd(),
16659
+ initialPosition: getSelectedBlocksInitialCaretPosition()
16660
+ }
16661
+ });
16662
+ }
16663
 
16664
+ previousAreBlocksDifferent = areBlocksDifferent;
 
 
 
16665
  });
16666
+ return () => unsubscribe();
16667
+ }, [registry, clientId]);
16668
  }
16669
+ //# sourceMappingURL=use-block-sync.js.map
16670
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/provider/index.js
16671
 
 
 
 
 
 
 
 
 
 
16672
 
16673
+ /**
16674
+ * WordPress dependencies
16675
+ */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16676
 
 
 
 
 
16677
 
16678
+ /**
16679
+ * Internal dependencies
16680
+ */
16681
 
 
 
 
16682
 
 
 
 
16683
 
 
 
 
16684
 
 
 
 
 
16685
 
16686
+ /** @typedef {import('@wordpress/data').WPDataRegistry} WPDataRegistry */
 
 
16687
 
16688
+ function BlockEditorProvider(props) {
16689
+ const {
16690
+ children,
16691
+ settings
16692
+ } = props;
16693
+ const {
16694
+ updateSettings
16695
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
16696
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
16697
+ updateSettings(settings);
16698
+ }, [settings]); // Syncs the entity provider with changes in the block-editor store.
16699
 
16700
+ useBlockSync(props);
16701
+ return (0,external_wp_element_namespaceObject.createElement)(BlockRefsProvider, null, children);
16702
+ }
16703
 
16704
+ /* harmony default export */ var provider = (with_registry_provider(BlockEditorProvider));
16705
+ //# sourceMappingURL=index.js.map
16706
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-preview/live.js
 
 
 
 
 
 
16707
 
 
 
 
16708
 
16709
+ /**
16710
+ * WordPress dependencies
16711
+ */
 
 
16712
 
16713
+ /**
16714
+ * Internal dependencies
16715
+ */
16716
 
 
 
 
 
16717
 
16718
+ function LiveBlockPreview({
16719
+ onClick
16720
+ }) {
16721
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
16722
+ tabIndex: 0,
16723
+ role: "button",
16724
+ onClick: onClick,
16725
+ onKeyPress: onClick
16726
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Disabled, null, (0,external_wp_element_namespaceObject.createElement)(BlockList, null)));
16727
+ }
16728
+ //# sourceMappingURL=live.js.map
16729
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-selection-clearer/index.js
16730
 
 
 
16731
 
 
 
 
16732
 
16733
+ /**
16734
+ * WordPress dependencies
16735
+ */
 
 
16736
 
 
 
 
 
16737
 
16738
+ /**
16739
+ * Internal dependencies
16740
+ */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16741
 
 
 
16742
 
16743
+ /**
16744
+ * Pass the returned ref callback to an element that should clear block
16745
+ * selection. Selection will only be cleared if the element is clicked directly,
16746
+ * not if a child element is clicked.
16747
+ *
16748
+ * @return {import('react').RefCallback} Ref callback.
16749
+ */
16750
 
16751
+ function useBlockSelectionClearer() {
16752
+ const {
16753
+ hasSelectedBlock,
16754
+ hasMultiSelection
16755
+ } = (0,external_wp_data_namespaceObject.useSelect)(store);
16756
+ const {
16757
+ clearSelectedBlock
16758
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
16759
+ return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
16760
+ function onMouseDown(event) {
16761
+ if (!hasSelectedBlock() && !hasMultiSelection()) {
16762
+ return;
16763
+ } // Only handle clicks on the element, not the children.
16764
 
 
 
16765
 
16766
+ if (event.target !== node) {
16767
+ return;
16768
+ }
 
 
16769
 
16770
+ clearSelectedBlock();
16771
+ }
 
 
 
 
 
16772
 
16773
+ node.addEventListener('mousedown', onMouseDown);
16774
+ return () => {
16775
+ node.removeEventListener('mousedown', onMouseDown);
16776
+ };
16777
+ }, [hasSelectedBlock, hasMultiSelection, clearSelectedBlock]);
16778
+ }
16779
+ function BlockSelectionClearer(props) {
16780
+ return (0,external_wp_element_namespaceObject.createElement)("div", _extends({
16781
+ ref: useBlockSelectionClearer()
16782
+ }, props));
16783
+ }
16784
+ //# sourceMappingURL=index.js.map
16785
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/writing-flow/use-multi-selection.js
16786
+ /**
16787
+ * External dependencies
16788
+ */
16789
 
16790
+ /**
16791
+ * WordPress dependencies
16792
+ */
 
 
16793
 
 
 
 
16794
 
 
 
 
 
 
16795
 
16796
+ /**
16797
+ * Internal dependencies
16798
+ */
 
 
 
16799
 
 
 
16800
 
 
 
16801
 
 
 
 
 
16802
 
16803
+ function use_multi_selection_toggleRichText(container, toggle) {
16804
+ Array.from(container.querySelectorAll('.rich-text')).forEach(node => {
16805
+ if (toggle) {
16806
+ node.setAttribute('contenteditable', true);
16807
+ } else {
16808
+ node.removeAttribute('contenteditable');
16809
  }
16810
+ });
16811
+ }
16812
+ /**
16813
+ * Returns for the deepest node at the start or end of a container node. Ignores
16814
+ * any text nodes that only contain HTML formatting whitespace.
16815
+ *
16816
+ * @param {Element} node Container to search.
16817
+ * @param {string} type 'start' or 'end'.
16818
+ */
16819
 
 
 
 
16820
 
16821
+ function getDeepestNode(node, type) {
16822
+ const child = type === 'start' ? 'firstChild' : 'lastChild';
16823
+ const sibling = type === 'start' ? 'nextSibling' : 'previousSibling';
16824
 
16825
+ while (node[child]) {
16826
+ node = node[child];
 
 
16827
 
16828
+ while (node.nodeType === node.TEXT_NODE && /^[ \t\n]*$/.test(node.data) && node[sibling]) {
16829
+ node = node[sibling];
16830
+ }
 
16831
  }
16832
 
16833
+ return node;
16834
+ }
 
 
 
16835
 
16836
+ function selector(select) {
16837
+ const {
16838
+ isMultiSelecting,
16839
+ getMultiSelectedBlockClientIds,
16840
+ hasMultiSelection,
16841
+ getSelectedBlockClientId
16842
+ } = select(store);
16843
+ return {
16844
+ isMultiSelecting: isMultiSelecting(),
16845
+ multiSelectedBlockClientIds: getMultiSelectedBlockClientIds(),
16846
+ hasMultiSelection: hasMultiSelection(),
16847
+ selectedBlockClientId: getSelectedBlockClientId()
16848
+ };
16849
+ }
16850
 
16851
+ function use_multi_selection_useMultiSelection() {
16852
+ const {
16853
+ isMultiSelecting,
16854
+ multiSelectedBlockClientIds,
16855
+ hasMultiSelection,
16856
+ selectedBlockClientId
16857
+ } = (0,external_wp_data_namespaceObject.useSelect)(selector, []);
16858
+ const selectedRef = useBlockRef(selectedBlockClientId); // These must be in the right DOM order.
16859
 
16860
+ const startRef = useBlockRef((0,external_lodash_namespaceObject.first)(multiSelectedBlockClientIds));
16861
+ const endRef = useBlockRef((0,external_lodash_namespaceObject.last)(multiSelectedBlockClientIds));
16862
+ /**
16863
+ * When the component updates, and there is multi selection, we need to
16864
+ * select the entire block contents.
16865
+ */
16866
 
16867
+ return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
16868
+ const {
16869
+ ownerDocument
16870
+ } = node;
16871
+ const {
16872
+ defaultView
16873
+ } = ownerDocument;
16874
+
16875
+ if (!hasMultiSelection || isMultiSelecting) {
16876
+ if (!selectedBlockClientId || isMultiSelecting) {
16877
+ return;
16878
+ }
16879
+
16880
+ const selection = defaultView.getSelection();
16881
 
16882
+ if (selection.rangeCount && !selection.isCollapsed) {
16883
+ const blockNode = selectedRef.current;
16884
+ const {
16885
+ startContainer,
16886
+ endContainer
16887
+ } = selection.getRangeAt(0);
16888
 
16889
+ if (!!blockNode && (!blockNode.contains(startContainer) || !blockNode.contains(endContainer))) {
16890
+ selection.removeAllRanges();
16891
+ }
16892
+ }
16893
 
16894
+ return;
 
 
 
 
 
 
16895
  }
16896
 
 
 
 
 
16897
  const {
16898
+ length
16899
+ } = multiSelectedBlockClientIds;
 
 
16900
 
16901
+ if (length < 2) {
16902
+ return;
16903
+ } // The block refs might not be immediately available
16904
+ // when dragging blocks into another block.
16905
 
 
 
 
 
 
16906
 
16907
+ if (!startRef.current || !endRef.current) {
16908
+ return;
16909
+ } // For some browsers, like Safari, it is important that focus happens
16910
+ // BEFORE selection.
 
 
 
16911
 
 
 
 
 
 
 
 
16912
 
16913
+ node.focus();
16914
+ const selection = defaultView.getSelection();
16915
+ const range = ownerDocument.createRange(); // These must be in the right DOM order.
16916
+ // The most stable way to select the whole block contents is to start
16917
+ // and end at the deepest points.
16918
 
16919
+ const startNode = getDeepestNode(startRef.current, 'start');
16920
+ const endNode = getDeepestNode(endRef.current, 'end'); // While rich text will be disabled with a delay when there is a multi
16921
+ // selection, we must do it immediately because it's not possible to set
16922
+ // selection across editable hosts.
16923
 
16924
+ use_multi_selection_toggleRichText(node, false);
16925
+ range.setStartBefore(startNode);
16926
+ range.setEndAfter(endNode);
16927
+ selection.removeAllRanges();
16928
+ selection.addRange(range);
16929
+ }, [hasMultiSelection, isMultiSelecting, multiSelectedBlockClientIds, selectedBlockClientId]);
16930
+ }
16931
+ //# sourceMappingURL=use-multi-selection.js.map
16932
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/writing-flow/use-tab-nav.js
16933
 
 
 
 
 
16934
 
16935
+ /**
16936
+ * WordPress dependencies
16937
+ */
16938
 
 
 
 
 
 
 
16939
 
 
 
16940
 
 
 
16941
 
 
 
 
 
 
 
 
16942
 
16943
+ /**
16944
+ * Internal dependencies
16945
+ */
16946
 
 
 
 
16947
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16948
 
16949
+ function isFormElement(element) {
16950
+ const {
16951
+ tagName
16952
+ } = element;
16953
+ return tagName === 'INPUT' || tagName === 'BUTTON' || tagName === 'SELECT' || tagName === 'TEXTAREA';
16954
+ }
16955
 
16956
+ function useTabNav() {
16957
+ const container = (0,external_wp_element_namespaceObject.useRef)();
16958
+ const focusCaptureBeforeRef = (0,external_wp_element_namespaceObject.useRef)();
16959
+ const focusCaptureAfterRef = (0,external_wp_element_namespaceObject.useRef)();
16960
+ const lastFocus = (0,external_wp_element_namespaceObject.useRef)();
16961
+ const {
16962
+ hasMultiSelection,
16963
+ getSelectedBlockClientId,
16964
+ getBlockCount
16965
+ } = (0,external_wp_data_namespaceObject.useSelect)(store);
16966
+ const {
16967
+ setNavigationMode
16968
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
16969
+ const isNavigationMode = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isNavigationMode(), []); // Don't allow tabbing to this element in Navigation mode.
16970
 
16971
+ const focusCaptureTabIndex = !isNavigationMode ? '0' : undefined; // Reference that holds the a flag for enabling or disabling
16972
+ // capturing on the focus capture elements.
 
 
16973
 
16974
+ const noCapture = (0,external_wp_element_namespaceObject.useRef)();
 
 
16975
 
16976
+ function onFocusCapture(event) {
16977
+ // Do not capture incoming focus if set by us in WritingFlow.
16978
+ if (noCapture.current) {
16979
+ noCapture.current = null;
16980
+ } else if (hasMultiSelection()) {
16981
+ container.current.focus();
16982
+ } else if (getSelectedBlockClientId()) {
16983
+ lastFocus.current.focus();
16984
+ } else {
16985
+ setNavigationMode(true);
16986
+ const isBefore = // eslint-disable-next-line no-bitwise
16987
+ event.target.compareDocumentPosition(container.current) & event.target.DOCUMENT_POSITION_FOLLOWING;
16988
+ const action = isBefore ? 'findNext' : 'findPrevious';
16989
+ external_wp_dom_namespaceObject.focus.tabbable[action](event.target).focus();
16990
  }
16991
+ }
16992
 
16993
+ const before = (0,external_wp_element_namespaceObject.createElement)("div", {
16994
+ ref: focusCaptureBeforeRef,
16995
+ tabIndex: focusCaptureTabIndex,
16996
+ onFocus: onFocusCapture
16997
+ });
16998
+ const after = (0,external_wp_element_namespaceObject.createElement)("div", {
16999
+ ref: focusCaptureAfterRef,
17000
+ tabIndex: focusCaptureTabIndex,
17001
+ onFocus: onFocusCapture
17002
+ });
17003
+ const ref = (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
17004
+ function onKeyDown(event) {
17005
+ if (event.defaultPrevented) {
17006
+ return;
17007
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17008
 
17009
+ if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !hasMultiSelection()) {
17010
+ event.preventDefault();
17011
+ setNavigationMode(true);
17012
+ return;
17013
+ } // In Edit mode, Tab should focus the first tabbable element after
17014
+ // the content, which is normally the sidebar (with block controls)
17015
+ // and Shift+Tab should focus the first tabbable element before the
17016
+ // content, which is normally the block toolbar.
17017
+ // Arrow keys can be used, and Tab and arrow keys can be used in
17018
+ // Navigation mode (press Esc), to navigate through blocks.
17019
 
 
 
17020
 
17021
+ if (event.keyCode !== external_wp_keycodes_namespaceObject.TAB) {
17022
+ return;
17023
+ }
17024
 
17025
+ const isShift = event.shiftKey;
17026
+ const direction = isShift ? 'findPrevious' : 'findNext';
17027
 
17028
+ if (!hasMultiSelection() && !getSelectedBlockClientId()) {
17029
+ // Preserve the behaviour of entering navigation mode when
17030
+ // tabbing into the content without a block selection.
17031
+ // `onFocusCapture` already did this previously, but we need to
17032
+ // do it again here because after clearing block selection,
17033
+ // focus land on the writing flow container and pressing Tab
17034
+ // will no longer send focus through the focus capture element.
17035
+ if (event.target === node) setNavigationMode(true);
17036
+ return;
17037
+ } // Allow tabbing between form elements rendered in a block,
17038
+ // such as inside a placeholder. Form elements are generally
17039
+ // meant to be UI rather than part of the content. Ideally
17040
+ // these are not rendered in the content and perhaps in the
17041
+ // future they can be rendered in an iframe or shadow DOM.
17042
 
 
 
 
 
 
 
 
 
17043
 
17044
+ if (isFormElement(event.target) && isFormElement(external_wp_dom_namespaceObject.focus.tabbable[direction](event.target))) {
17045
+ return;
17046
+ }
17047
 
17048
+ const next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef; // Disable focus capturing on the focus capture element, so it
17049
+ // doesn't refocus this block and so it allows default behaviour
17050
+ // (moving focus to the next tabbable element).
17051
 
17052
+ noCapture.current = true; // Focusing the focus capture element, which is located above and
17053
+ // below the editor, should not scroll the page all the way up or
17054
+ // down.
17055
 
17056
+ next.current.focus({
17057
+ preventScroll: true
17058
+ });
17059
  }
17060
 
17061
+ function onFocusOut(event) {
17062
+ lastFocus.current = event.target;
17063
+ const {
17064
+ ownerDocument
17065
+ } = node; // If focus disappears due to there being no blocks, move focus to
17066
+ // the writing flow wrapper.
 
 
17067
 
17068
+ if (!event.relatedTarget && ownerDocument.activeElement === ownerDocument.body && getBlockCount() === 0) {
17069
+ node.focus();
 
 
17070
  }
17071
+ } // When tabbing back to an element in block list, this event handler prevents scrolling if the
17072
+ // focus capture divs (before/after) are outside of the viewport. (For example shift+tab back to a paragraph
17073
+ // when focus is on a sidebar element. This prevents the scrollable writing area from jumping either to the
17074
+ // top or bottom of the document.
17075
+ //
17076
+ // Note that it isn't possible to disable scrolling in the onFocus event. We need to intercept this
17077
+ // earlier in the keypress handler, and call focus( { preventScroll: true } ) instead.
17078
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus#parameters
17079
 
 
 
 
17080
 
17081
+ function preventScrollOnTab(event) {
17082
+ var _event$target;
17083
 
17084
+ if (event.keyCode !== external_wp_keycodes_namespaceObject.TAB) {
17085
+ return;
 
17086
  }
17087
 
17088
+ if (((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.getAttribute('role')) === 'region') {
17089
+ return;
17090
  }
 
 
 
 
 
 
 
 
 
17091
 
17092
+ if (container.current === event.target) {
17093
+ return;
 
 
17094
  }
17095
 
17096
+ const isShift = event.shiftKey;
17097
+ const direction = isShift ? 'findPrevious' : 'findNext';
17098
+ const target = external_wp_dom_namespaceObject.focus.tabbable[direction](event.target); // only do something when the next tabbable is a focus capture div (before/after)
17099
 
17100
+ if (target === focusCaptureBeforeRef.current || target === focusCaptureAfterRef.current) {
17101
+ event.preventDefault();
17102
+ target.focus({
17103
+ preventScroll: true
17104
+ });
17105
  }
17106
+ }
17107
 
17108
+ const {
17109
+ ownerDocument
17110
+ } = node;
17111
+ const {
17112
+ defaultView
17113
+ } = ownerDocument;
17114
+ defaultView.addEventListener('keydown', preventScrollOnTab);
17115
+ node.addEventListener('keydown', onKeyDown);
17116
+ node.addEventListener('focusout', onFocusOut);
17117
+ return () => {
17118
+ defaultView.removeEventListener('keydown', preventScrollOnTab);
17119
+ node.removeEventListener('keydown', onKeyDown);
17120
+ node.removeEventListener('focusout', onFocusOut);
17121
+ };
17122
+ }, []);
17123
+ const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([container, ref]);
17124
+ return [before, mergedRefs, after];
17125
+ }
17126
+ //# sourceMappingURL=use-tab-nav.js.map
17127
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/writing-flow/use-arrow-nav.js
17128
+ /**
17129
+ * External dependencies
17130
+ */
17131
 
17132
+ /**
17133
+ * WordPress dependencies
17134
+ */
17135
 
 
 
 
17136
 
 
 
 
 
 
 
 
 
17137
 
 
 
 
17138
 
 
 
 
 
 
 
 
 
 
 
17139
 
17140
+ /**
17141
+ * Internal dependencies
17142
+ */
17143
 
 
 
 
 
17144
 
 
17145
 
17146
+ /**
17147
+ * Returns true if the element should consider edge navigation upon a keyboard
17148
+ * event of the given directional key code, or false otherwise.
17149
+ *
17150
+ * @param {Element} element HTML element to test.
17151
+ * @param {number} keyCode KeyboardEvent keyCode to test.
17152
+ * @param {boolean} hasModifier Whether a modifier is pressed.
17153
+ *
17154
+ * @return {boolean} Whether element should consider edge navigation.
17155
+ */
17156
 
17157
+ function isNavigationCandidate(element, keyCode, hasModifier) {
17158
+ const isVertical = keyCode === external_wp_keycodes_namespaceObject.UP || keyCode === external_wp_keycodes_namespaceObject.DOWN; // Currently, all elements support unmodified vertical navigation.
 
 
 
17159
 
17160
+ if (isVertical && !hasModifier) {
17161
+ return true;
17162
+ } // Native inputs should not navigate horizontally.
17163
 
 
 
 
 
17164
 
17165
+ const {
17166
+ tagName
17167
+ } = element;
17168
+ return tagName !== 'INPUT' && tagName !== 'TEXTAREA';
17169
+ }
17170
+ /**
17171
+ * Returns the optimal tab target from the given focused element in the desired
17172
+ * direction. A preference is made toward text fields, falling back to the block
17173
+ * focus stop if no other candidates exist for the block.
17174
+ *
17175
+ * @param {Element} target Currently focused text field.
17176
+ * @param {boolean} isReverse True if considering as the first field.
17177
+ * @param {Element} containerElement Element containing all blocks.
17178
+ * @param {boolean} onlyVertical Whether to only consider tabbable elements
17179
+ * that are visually above or under the
17180
+ * target.
17181
+ *
17182
+ * @return {?Element} Optimal tab target, if one exists.
17183
+ */
17184
+
17185
+ function getClosestTabbable(target, isReverse, containerElement, onlyVertical) {
17186
+ // Since the current focus target is not guaranteed to be a text field, find
17187
+ // all focusables. Tabbability is considered later.
17188
+ let focusableNodes = external_wp_dom_namespaceObject.focus.focusable.find(containerElement);
17189
+
17190
+ if (isReverse) {
17191
+ focusableNodes = (0,external_lodash_namespaceObject.reverse)(focusableNodes);
17192
+ } // Consider as candidates those focusables after the current target. It's
17193
+ // assumed this can only be reached if the target is focusable (on its
17194
+ // keydown event), so no need to verify it exists in the set.
17195
+
17196
 
17197
+ focusableNodes = focusableNodes.slice(focusableNodes.indexOf(target) + 1);
17198
+ let targetRect;
 
 
17199
 
17200
+ if (onlyVertical) {
17201
+ targetRect = target.getBoundingClientRect();
 
17202
  }
17203
 
17204
+ function isTabCandidate(node) {
17205
+ // Not a candidate if the node is not tabbable.
17206
+ if (!external_wp_dom_namespaceObject.focus.tabbable.isTabbableIndex(node)) {
17207
+ return false;
17208
+ } // Skip focusable elements such as links within content editable nodes.
17209
 
 
 
17210
 
17211
+ if (node.isContentEditable && node.contentEditable !== 'true') {
17212
+ return false;
17213
+ }
17214
 
17215
+ if (onlyVertical) {
17216
+ const nodeRect = node.getBoundingClientRect();
 
 
 
17217
 
17218
+ if (nodeRect.left >= targetRect.right || nodeRect.right <= targetRect.left) {
17219
+ return false;
 
 
 
17220
  }
17221
  }
17222
 
17223
+ return true;
 
 
 
 
 
 
 
 
 
17224
  }
17225
 
17226
+ return (0,external_lodash_namespaceObject.find)(focusableNodes, isTabCandidate);
17227
+ }
17228
+ function useArrowNav() {
17229
+ const {
17230
+ getSelectedBlockClientId,
17231
+ getMultiSelectedBlocksStartClientId,
17232
+ getMultiSelectedBlocksEndClientId,
17233
+ getPreviousBlockClientId,
17234
+ getNextBlockClientId,
17235
+ getFirstMultiSelectedBlockClientId,
17236
+ getLastMultiSelectedBlockClientId,
17237
+ getSettings,
17238
+ hasMultiSelection
17239
+ } = (0,external_wp_data_namespaceObject.useSelect)(store);
17240
+ const {
17241
+ multiSelect,
17242
+ selectBlock
17243
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
17244
+ return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
17245
+ // Here a DOMRect is stored while moving the caret vertically so
17246
+ // vertical position of the start position can be restored. This is to
17247
+ // recreate browser behaviour across blocks.
17248
+ let verticalRect;
17249
 
17250
+ function onMouseDown() {
17251
+ verticalRect = null;
17252
  }
17253
 
17254
+ function expandSelection(isReverse) {
17255
+ const selectedBlockClientId = getSelectedBlockClientId();
17256
+ const selectionStartClientId = getMultiSelectedBlocksStartClientId();
17257
+ const selectionEndClientId = getMultiSelectedBlocksEndClientId();
17258
+ const selectionBeforeEndClientId = getPreviousBlockClientId(selectionEndClientId || selectedBlockClientId);
17259
+ const selectionAfterEndClientId = getNextBlockClientId(selectionEndClientId || selectedBlockClientId);
17260
+ const nextSelectionEndClientId = isReverse ? selectionBeforeEndClientId : selectionAfterEndClientId;
 
17261
 
17262
+ if (nextSelectionEndClientId) {
17263
+ if (selectionStartClientId === nextSelectionEndClientId) {
17264
+ selectBlock(nextSelectionEndClientId);
17265
+ } else {
17266
+ multiSelect(selectionStartClientId || selectedBlockClientId, nextSelectionEndClientId);
17267
+ }
17268
+ }
17269
  }
17270
 
17271
+ function moveSelection(isReverse) {
17272
+ const selectedFirstClientId = getFirstMultiSelectedBlockClientId();
17273
+ const selectedLastClientId = getLastMultiSelectedBlockClientId();
17274
+ const focusedBlockClientId = isReverse ? selectedFirstClientId : selectedLastClientId;
17275
 
17276
+ if (focusedBlockClientId) {
17277
+ selectBlock(focusedBlockClientId);
17278
  }
17279
  }
17280
+ /**
17281
+ * Returns true if the given target field is the last in its block which
17282
+ * can be considered for tab transition. For example, in a block with
17283
+ * two text fields, this would return true when reversing from the first
17284
+ * of the two fields, but false when reversing from the second.
17285
+ *
17286
+ * @param {Element} target Currently focused text field.
17287
+ * @param {boolean} isReverse True if considering as the first field.
17288
+ *
17289
+ * @return {boolean} Whether field is at edge for tab transition.
17290
+ */
17291
 
17292
+
17293
+ function isTabbableEdge(target, isReverse) {
17294
+ const closestTabbable = getClosestTabbable(target, isReverse, node);
17295
+ return !closestTabbable || !isInSameBlock(target, closestTabbable);
 
17296
  }
 
17297
 
17298
+ function onKeyDown(event) {
17299
+ const {
17300
+ keyCode,
17301
+ target
17302
+ } = event;
17303
+ const isUp = keyCode === external_wp_keycodes_namespaceObject.UP;
17304
+ const isDown = keyCode === external_wp_keycodes_namespaceObject.DOWN;
17305
+ const isLeft = keyCode === external_wp_keycodes_namespaceObject.LEFT;
17306
+ const isRight = keyCode === external_wp_keycodes_namespaceObject.RIGHT;
17307
+ const isReverse = isUp || isLeft;
17308
+ const isHorizontal = isLeft || isRight;
17309
+ const isVertical = isUp || isDown;
17310
+ const isNav = isHorizontal || isVertical;
17311
+ const isShift = event.shiftKey;
17312
+ const hasModifier = isShift || event.ctrlKey || event.altKey || event.metaKey;
17313
+ const isNavEdge = isVertical ? external_wp_dom_namespaceObject.isVerticalEdge : external_wp_dom_namespaceObject.isHorizontalEdge;
17314
+ const {
17315
+ ownerDocument
17316
+ } = node;
17317
+ const {
17318
+ defaultView
17319
+ } = ownerDocument;
17320
 
17321
+ if (hasMultiSelection()) {
17322
+ if (isNav) {
17323
+ const action = isShift ? expandSelection : moveSelection;
17324
+ action(isReverse);
17325
+ event.preventDefault();
17326
+ }
17327
 
17328
+ return;
17329
+ } // When presing any key other than up or down, the initial vertical
17330
+ // position must ALWAYS be reset. The vertical position is saved so
17331
+ // it can be restored as well as possible on sebsequent vertical
17332
+ // arrow key presses. It may not always be possible to restore the
17333
+ // exact same position (such as at an empty line), so it wouldn't be
17334
+ // good to compute the position right before any vertical arrow key
17335
+ // press.
17336
 
 
 
 
 
 
 
17337
 
17338
+ if (!isVertical) {
17339
+ verticalRect = null;
17340
+ } else if (!verticalRect) {
17341
+ verticalRect = (0,external_wp_dom_namespaceObject.computeCaretRect)(defaultView);
17342
+ } // Abort if navigation has already been handled (e.g. RichText
17343
+ // inline boundaries).
17344
 
 
 
 
 
 
17345
 
17346
+ if (event.defaultPrevented) {
17347
+ return;
17348
+ }
17349
 
17350
+ if (!isNav) {
17351
+ return;
17352
+ } // Abort if our current target is not a candidate for navigation
17353
+ // (e.g. preserve native input behaviors).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17354
 
 
 
 
17355
 
17356
+ if (!isNavigationCandidate(target, keyCode, hasModifier)) {
17357
+ return;
17358
+ } // In the case of RTL scripts, right means previous and left means
17359
+ // next, which is the exact reverse of LTR.
17360
 
 
 
 
17361
 
17362
+ const isReverseDir = (0,external_wp_dom_namespaceObject.isRTL)(target) ? !isReverse : isReverse;
17363
+ const {
17364
+ keepCaretInsideBlock
17365
+ } = getSettings();
17366
+ const selectedBlockClientId = getSelectedBlockClientId();
17367
 
17368
+ if (isShift) {
17369
+ const selectionEndClientId = getMultiSelectedBlocksEndClientId();
17370
+ const selectionBeforeEndClientId = getPreviousBlockClientId(selectionEndClientId || selectedBlockClientId);
17371
+ const selectionAfterEndClientId = getNextBlockClientId(selectionEndClientId || selectedBlockClientId);
17372
 
17373
+ if ( // Ensure that there is a target block.
17374
+ (isReverse && selectionBeforeEndClientId || !isReverse && selectionAfterEndClientId) && isTabbableEdge(target, isReverse) && isNavEdge(target, isReverse)) {
17375
+ // Shift key is down, and there is multi selection or we're
17376
+ // at the end of the current block.
17377
+ expandSelection(isReverse);
17378
+ event.preventDefault();
17379
+ }
17380
+ } else if (isVertical && (0,external_wp_dom_namespaceObject.isVerticalEdge)(target, isReverse) && !keepCaretInsideBlock) {
17381
+ const closestTabbable = getClosestTabbable(target, isReverse, node, true);
17382
 
17383
+ if (closestTabbable) {
17384
+ (0,external_wp_dom_namespaceObject.placeCaretAtVerticalEdge)(closestTabbable, isReverse, verticalRect);
17385
+ event.preventDefault();
17386
+ }
17387
+ } else if (isHorizontal && defaultView.getSelection().isCollapsed && (0,external_wp_dom_namespaceObject.isHorizontalEdge)(target, isReverseDir) && !keepCaretInsideBlock) {
17388
+ const closestTabbable = getClosestTabbable(target, isReverseDir, node);
17389
+ (0,external_wp_dom_namespaceObject.placeCaretAtHorizontalEdge)(closestTabbable, isReverse);
17390
+ event.preventDefault();
17391
+ }
17392
+ }
17393
 
17394
+ node.addEventListener('mousedown', onMouseDown);
17395
+ node.addEventListener('keydown', onKeyDown);
17396
+ return () => {
17397
+ node.removeEventListener('mousedown', onMouseDown);
17398
+ node.removeEventListener('keydown', onKeyDown);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17399
  };
17400
+ }, []);
17401
+ }
17402
+ //# sourceMappingURL=use-arrow-nav.js.map
17403
+ ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
17404
+ var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
17405
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/writing-flow/use-select-all.js
17406
+ /**
17407
+ * External dependencies
17408
+ */
17409
 
17410
+ /**
17411
+ * WordPress dependencies
17412
+ */
17413
 
 
 
 
 
 
 
17414
 
 
 
 
17415
 
 
 
 
17416
 
 
 
 
17417
 
17418
+ /**
17419
+ * Internal dependencies
17420
+ */
 
 
17421
 
 
 
 
17422
 
17423
+ function useSelectAll() {
17424
+ const {
17425
+ getBlockOrder,
17426
+ getSelectedBlockClientIds,
17427
+ getBlockRootClientId
17428
+ } = (0,external_wp_data_namespaceObject.useSelect)(store);
17429
+ const {
17430
+ multiSelect
17431
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
17432
+ const isMatch = (0,external_wp_keyboardShortcuts_namespaceObject.__unstableUseShortcutEventMatch)();
17433
+ return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
17434
+ function onKeyDown(event) {
17435
+ if (!isMatch('core/block-editor/select-all', event)) {
17436
+ return;
17437
  }
 
 
 
 
 
 
 
 
 
 
17438
 
17439
+ if (!(0,external_wp_dom_namespaceObject.isEntirelySelected)(event.target)) {
17440
+ return;
17441
+ }
 
17442
 
17443
+ const selectedClientIds = getSelectedBlockClientIds();
17444
+ const [firstSelectedClientId] = selectedClientIds;
17445
+ const rootClientId = getBlockRootClientId(firstSelectedClientId);
17446
+ let blockClientIds = getBlockOrder(rootClientId); // If we have selected all sibling nested blocks, try selecting up a
17447
+ // level. See: https://github.com/WordPress/gutenberg/pull/31859/
17448
 
17449
+ if (selectedClientIds.length === blockClientIds.length) {
17450
+ blockClientIds = getBlockOrder(getBlockRootClientId(rootClientId));
17451
+ }
17452
 
17453
+ const firstClientId = (0,external_lodash_namespaceObject.first)(blockClientIds);
17454
+ const lastClientId = (0,external_lodash_namespaceObject.last)(blockClientIds);
 
17455
 
17456
+ if (firstClientId === lastClientId) {
17457
+ return;
17458
+ }
 
17459
 
17460
+ multiSelect(firstClientId, lastClientId);
17461
+ event.preventDefault();
 
 
 
 
17462
  }
17463
 
17464
+ node.addEventListener('keydown', onKeyDown);
17465
+ return () => {
17466
+ node.removeEventListener('keydown', onKeyDown);
17467
+ };
17468
+ }, []);
17469
+ }
17470
+ //# sourceMappingURL=use-select-all.js.map
17471
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/writing-flow/index.js
17472
 
 
 
 
 
 
 
 
 
 
17473
 
 
 
17474
 
17475
+ /**
17476
+ * External dependencies
17477
+ */
 
 
 
 
 
 
17478
 
17479
+ /**
17480
+ * WordPress dependencies
17481
+ */
17482
 
 
 
 
17483
 
 
 
 
 
 
 
 
 
17484
 
 
 
 
 
 
 
 
17485
 
 
 
17486
 
17487
+ /**
17488
+ * Internal dependencies
17489
+ */
 
 
 
17490
 
 
 
 
 
 
 
 
 
17491
 
 
 
 
17492
 
 
 
 
 
 
 
17493
 
 
 
17494
 
17495
+
17496
+ function useWritingFlow() {
17497
+ const [before, ref, after] = useTabNav();
17498
+ const hasMultiSelection = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).hasMultiSelection(), []);
17499
+ return [before, (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, use_multi_selection_useMultiSelection(), useSelectAll(), useArrowNav(), (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
17500
+ node.tabIndex = -1;
17501
+
17502
+ if (!hasMultiSelection) {
17503
+ return;
17504
+ }
17505
+
17506
+ node.setAttribute('aria-label', (0,external_wp_i18n_namespaceObject.__)('Multiple selected blocks'));
17507
+ return () => {
17508
+ node.removeAttribute('aria-label');
17509
+ };
17510
+ }, [hasMultiSelection])]), after];
17511
  }
17512
+
17513
+ function WritingFlow({
17514
+ children,
17515
+ ...props
17516
+ }, forwardedRef) {
17517
+ const [before, ref, after] = useWritingFlow();
17518
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, before, (0,external_wp_element_namespaceObject.createElement)("div", _extends({}, props, {
17519
+ ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, forwardedRef]),
17520
+ className: classnames_default()(props.className, 'block-editor-writing-flow')
17521
+ }), children), after);
17522
  }
17523
+ /**
17524
+ * Handles selection and navigation across blocks. This component should be
17525
+ * wrapped around BlockList.
17526
+ *
17527
+ * @param {Object} props Component properties.
17528
+ * @param {WPElement} props.children Children to be rendered.
17529
+ */
 
 
 
17530
 
 
 
 
17531
 
17532
+ /* harmony default export */ var writing_flow = ((0,external_wp_element_namespaceObject.forwardRef)(WritingFlow));
17533
+ //# sourceMappingURL=index.js.map
17534
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/iframe/index.js
17535
 
 
 
 
17536
 
 
 
 
 
 
 
17537
 
17538
+ /**
17539
+ * External dependencies
17540
+ */
17541
 
17542
+ /**
17543
+ * WordPress dependencies
17544
+ */
 
 
17545
 
 
 
 
 
 
 
 
 
 
 
 
17546
 
 
 
 
 
 
 
17547
 
 
17548
 
 
 
 
 
 
 
17549
 
17550
+ /**
17551
+ * Internal dependencies
17552
+ */
17553
 
 
 
 
 
 
 
 
17554
 
 
 
 
 
 
 
 
 
 
17555
 
17556
+ const BODY_CLASS_NAME = 'editor-styles-wrapper';
17557
+ const BLOCK_PREFIX = 'wp-block';
17558
+ /**
17559
+ * Clones stylesheets targetting the editor canvas to the given document. A
17560
+ * stylesheet is considered targetting the editor a canvas if it contains the
17561
+ * `editor-styles-wrapper`, `wp-block`, or `wp-block-*` class selectors.
17562
+ *
17563
+ * Ideally, this hook should be removed in the future and styles should be added
17564
+ * explicitly as editor styles.
17565
+ *
17566
+ * @param {Document} doc The document to append cloned stylesheets to.
17567
+ */
17568
 
17569
+ function styleSheetsCompat(doc) {
17570
+ // Search the document for stylesheets targetting the editor canvas.
17571
+ Array.from(document.styleSheets).forEach(styleSheet => {
17572
+ try {
17573
+ // May fail for external styles.
17574
+ // eslint-disable-next-line no-unused-expressions
17575
+ styleSheet.cssRules;
17576
+ } catch (e) {
17577
+ return;
17578
+ }
17579
 
17580
+ const {
17581
+ ownerNode,
17582
+ cssRules
17583
+ } = styleSheet;
17584
 
17585
+ if (!cssRules) {
17586
+ return;
17587
+ } // Generally, ignore inline styles. We add inline styles belonging to a
17588
+ // stylesheet later, which may or may not match the selectors.
17589
 
 
 
 
 
 
17590
 
17591
+ if (ownerNode.tagName !== 'LINK') {
17592
+ return;
17593
+ } // Don't try to add the reset styles, which were removed as a dependency
17594
+ // from `edit-blocks` for the iframe since we don't need to reset admin
17595
+ // styles.
17596
 
 
 
 
 
17597
 
17598
+ if (ownerNode.id === 'wp-reset-editor-styles-css') {
17599
+ return;
17600
+ }
 
 
17601
 
17602
+ const isMatch = Array.from(cssRules).find(({
17603
+ selectorText
17604
+ }) => selectorText && (selectorText.includes(`.${BODY_CLASS_NAME}`) || selectorText.includes(`.${BLOCK_PREFIX}`)));
 
 
17605
 
17606
+ if (isMatch && !doc.getElementById(ownerNode.id)) {
17607
+ // eslint-disable-next-line no-console
17608
+ console.warn(`Stylesheet ${ownerNode.id} was not properly added.
17609
+ For blocks, use the block API's style (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#style) or editorStyle (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#editor-style).
17610
+ For themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles).`, ownerNode.outerHTML);
17611
+ doc.head.appendChild(ownerNode.cloneNode(true)); // Add inline styles belonging to the stylesheet.
17612
 
17613
+ const inlineCssId = ownerNode.id.replace('-css', '-inline-css');
17614
+ const inlineCssElement = document.getElementById(inlineCssId);
17615
+
17616
+ if (inlineCssElement) {
17617
+ doc.head.appendChild(inlineCssElement.cloneNode(true));
17618
+ }
 
 
17619
  }
17620
  });
17621
  }
17622
+ /**
17623
+ * Bubbles some event types (keydown, keypress, and dragover) to parent document
17624
+ * document to ensure that the keyboard shortcuts and drag and drop work.
17625
+ *
17626
+ * Ideally, we should remove event bubbling in the future. Keyboard shortcuts
17627
+ * should be context dependent, e.g. actions on blocks like Cmd+A should not
17628
+ * work globally outside the block editor.
17629
+ *
17630
+ * @param {Document} doc Document to attach listeners to.
17631
+ */
17632
 
 
 
 
17633
 
17634
+ function bubbleEvents(doc) {
17635
+ const {
17636
+ defaultView
17637
+ } = doc;
17638
+ const {
17639
+ frameElement
17640
+ } = defaultView;
17641
 
17642
+ function bubbleEvent(event) {
17643
+ const prototype = Object.getPrototypeOf(event);
17644
+ const constructorName = prototype.constructor.name;
17645
+ const Constructor = window[constructorName];
17646
+ const init = {};
17647
 
17648
+ for (const key in event) {
17649
+ init[key] = event[key];
17650
+ }
 
 
 
 
 
17651
 
17652
+ if (event instanceof defaultView.MouseEvent) {
17653
+ const rect = frameElement.getBoundingClientRect();
17654
+ init.clientX += rect.left;
17655
+ init.clientY += rect.top;
17656
+ }
 
 
17657
 
17658
+ const newEvent = new Constructor(event.type, init);
17659
+ const cancelled = !frameElement.dispatchEvent(newEvent);
 
 
 
17660
 
17661
+ if (cancelled) {
17662
+ event.preventDefault();
17663
+ }
 
17664
  }
17665
 
17666
+ const eventTypes = ['dragover'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17667
 
17668
+ for (const name of eventTypes) {
17669
+ doc.addEventListener(name, bubbleEvent);
17670
+ }
 
 
17671
  }
17672
 
17673
+ function useParsedAssets(html) {
17674
+ return (0,external_wp_element_namespaceObject.useMemo)(() => {
17675
+ const doc = document.implementation.createHTMLDocument('');
17676
+ doc.body.innerHTML = html;
17677
+ return Array.from(doc.body.children);
17678
+ }, [html]);
17679
+ }
17680
 
17681
+ async function loadScript(head, {
17682
+ id,
17683
+ src
17684
+ }) {
17685
+ return new Promise((resolve, reject) => {
17686
+ const script = head.ownerDocument.createElement('script');
17687
+ script.id = id;
 
17688
 
17689
+ if (src) {
17690
+ script.src = src;
 
 
 
 
 
17691
 
17692
+ script.onload = () => resolve();
17693
 
17694
+ script.onerror = () => reject();
17695
+ } else {
17696
+ resolve();
17697
  }
 
 
 
 
 
 
 
 
 
 
 
17698
 
17699
+ head.appendChild(script);
17700
+ });
17701
+ }
 
17702
 
17703
+ function Iframe({
17704
+ contentRef,
17705
+ children,
17706
+ head,
17707
+ tabIndex = 0,
17708
+ ...props
17709
+ }, ref) {
17710
+ var _window$__editorAsset, _window$__editorAsset2;
17711
 
17712
+ const [, forceRender] = (0,external_wp_element_namespaceObject.useReducer)(() => ({}));
17713
+ const [iframeDocument, setIframeDocument] = (0,external_wp_element_namespaceObject.useState)();
17714
+ const [bodyClasses, setBodyClasses] = (0,external_wp_element_namespaceObject.useState)([]);
17715
+ const styles = useParsedAssets((_window$__editorAsset = window.__editorAssets) === null || _window$__editorAsset === void 0 ? void 0 : _window$__editorAsset.styles);
17716
+ const scripts = useParsedAssets((_window$__editorAsset2 = window.__editorAssets) === null || _window$__editorAsset2 === void 0 ? void 0 : _window$__editorAsset2.scripts);
17717
+ const clearerRef = useBlockSelectionClearer();
17718
+ const [before, writingFlowRef, after] = useWritingFlow();
17719
+ const setRef = (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
17720
+ function setDocumentIfReady() {
17721
+ const {
17722
+ contentDocument,
17723
+ ownerDocument
17724
+ } = node;
17725
+ const {
17726
+ readyState,
17727
+ documentElement
17728
+ } = contentDocument;
17729
 
17730
+ if (readyState !== 'interactive' && readyState !== 'complete') {
17731
+ return false;
 
17732
  }
 
 
 
17733
 
17734
+ bubbleEvents(contentDocument);
17735
+ setIframeDocument(contentDocument);
17736
+ clearerRef(documentElement); // Ideally ALL classes that are added through get_body_class should
17737
+ // be added in the editor too, which we'll somehow have to get from
17738
+ // the server in the future (which will run the PHP filters).
17739
 
17740
+ setBodyClasses(Array.from(ownerDocument.body.classList).filter(name => name.startsWith('admin-color-') || name === 'wp-embed-responsive'));
17741
+ contentDocument.dir = ownerDocument.dir;
17742
+ documentElement.removeChild(contentDocument.head);
17743
+ documentElement.removeChild(contentDocument.body);
17744
+ return true;
17745
+ }
17746
 
17747
+ if (setDocumentIfReady()) {
17748
+ return;
17749
+ } // Document is not immediately loaded in Firefox.
17750
 
 
 
 
17751
 
17752
+ node.addEventListener('load', () => {
17753
+ setDocumentIfReady();
17754
+ });
17755
+ }, []);
17756
+ const headRef = (0,external_wp_compose_namespaceObject.useRefEffect)(element => {
17757
+ scripts.reduce((promise, script) => promise.then(() => loadScript(element, script)), Promise.resolve()).finally(() => {
17758
+ // When script are loaded, re-render blocks to allow them
17759
+ // to initialise.
17760
+ forceRender();
17761
+ });
17762
+ }, []);
17763
+ const bodyRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([contentRef, clearerRef, writingFlowRef]);
17764
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
17765
+ if (iframeDocument) {
17766
+ styleSheetsCompat(iframeDocument);
17767
+ }
17768
+ }, [iframeDocument]);
17769
+ head = (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("style", null, 'body{margin:0}'), styles.map(({
17770
+ tagName,
17771
+ href,
17772
+ id,
17773
+ rel,
17774
+ media,
17775
+ textContent
17776
+ }) => {
17777
+ const TagName = tagName.toLowerCase();
17778
 
17779
+ if (TagName === 'style') {
17780
+ return (0,external_wp_element_namespaceObject.createElement)(TagName, {
17781
+ id,
17782
+ key: id
17783
+ }, textContent);
 
 
 
 
 
17784
  }
17785
 
17786
+ return (0,external_wp_element_namespaceObject.createElement)(TagName, {
17787
+ href,
17788
+ id,
17789
+ rel,
17790
+ media,
17791
+ key: id
 
 
17792
  });
17793
+ }), head);
17794
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, tabIndex >= 0 && before, (0,external_wp_element_namespaceObject.createElement)("iframe", _extends({}, props, {
17795
+ ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, setRef]),
17796
+ tabIndex: tabIndex,
17797
+ title: (0,external_wp_i18n_namespaceObject.__)('Editor canvas')
17798
+ }), iframeDocument && (0,external_wp_element_namespaceObject.createPortal)((0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("head", {
17799
+ ref: headRef
17800
+ }, head), (0,external_wp_element_namespaceObject.createElement)("body", {
17801
+ ref: bodyRef,
17802
+ className: classnames_default()(BODY_CLASS_NAME, ...bodyClasses)
17803
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalStyleProvider, {
17804
+ document: iframeDocument
17805
+ }, children))), iframeDocument.documentElement)), tabIndex >= 0 && after);
17806
+ }
 
 
 
17807
 
17808
+ /* harmony default export */ var iframe = ((0,external_wp_element_namespaceObject.forwardRef)(Iframe));
17809
+ //# sourceMappingURL=index.js.map
17810
+ ;// CONCATENATED MODULE: ./packages/block-editor/node_modules/colord/index.mjs
17811
+ var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n<t.length;n++){var e=t[n][0](r);if(e)return[e,t[n][1]]}return[null,void 0]},x=function(r){return"string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},I=function(r){return x(r)[1]},M=function(r,t){var n=c(r);return{h:n.h,s:e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return{h:n.h,s:n.s,l:e(n.l+100*t,0,100),a:n.a}},j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return"number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return"number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof j?r:new j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(j,y),S.push(r))})},E=function(){return new j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};
 
 
 
 
 
 
17812
 
17813
+ ;// CONCATENATED MODULE: ./packages/block-editor/node_modules/colord/plugins/names.mjs
17814
+ /* harmony default export */ function names(e,f){var a={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var d in a)r[a[d]]=d;var l={};e.prototype.toName=function(f){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var d,i,n=r[this.toHex()];if(n)return n;if(null==f?void 0:f.closest){var o=this.toRgb(),t=1/0,b="black";if(!l.length)for(var c in a)l[c]=new e(a[c]).toRgb();for(var g in a){var u=(d=o,i=l[g],Math.pow(d.r-i.r,2)+Math.pow(d.g-i.g,2)+Math.pow(d.b-i.b,2));u<t&&(t=u,b=g)}return b}};f.string.push([function(f){var r=f.toLowerCase(),d="transparent"===r?"#0000":a[r];return d?new e(d).toRgb():null},"name"])}
 
 
17815
 
17816
+ ;// CONCATENATED MODULE: ./packages/block-editor/node_modules/colord/plugins/a11y.mjs
17817
+ var a11y_o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},a11y_t=function(t){return.2126*a11y_o(t.r)+.7152*a11y_o(t.g)+.0722*a11y_o(t.b)};/* harmony default export */ function a11y(o){o.prototype.luminance=function(){return o=a11y_t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,a,i,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=a11y_t(e),d=a11y_t(v),n=u>d?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(a=2)&&(a=0),void 0===i&&(i=Math.pow(10,a)),Math.floor(i*n)/i+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(i=(r=t).size)?"normal":i,"AAA"===(a=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===a&&"large"===e?3:4.5);var r,n,a,i,e}}
17818
 
17819
+ // EXTERNAL MODULE: ./node_modules/traverse/index.js
17820
+ var traverse = __webpack_require__(3692);
17821
+ var traverse_default = /*#__PURE__*/__webpack_require__.n(traverse);
17822
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/transform-styles/ast/parse.js
17823
+ /* eslint-disable @wordpress/no-unused-vars-before-return */
17824
+ // Adapted from https://github.com/reworkcss/css
17825
+ // because we needed to remove source map support.
17826
+ // http://www.w3.org/TR/CSS21/grammar.htm
17827
+ // https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
17828
+ const commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
17829
+ /* harmony default export */ function parse(css, options) {
17830
+ options = options || {};
17831
+ /**
17832
+ * Positional.
17833
+ */
17834
 
17835
+ let lineno = 1;
17836
+ let column = 1;
17837
+ /**
17838
+ * Update lineno and column based on `str`.
17839
+ */
17840
 
17841
+ function updatePosition(str) {
17842
+ const lines = str.match(/\n/g);
17843
 
17844
+ if (lines) {
17845
+ lineno += lines.length;
17846
+ }
 
 
 
 
 
 
 
 
 
 
 
17847
 
17848
+ const i = str.lastIndexOf('\n'); // eslint-disable-next-line no-bitwise
 
 
 
 
17849
 
17850
+ column = ~i ? str.length - i : column + str.length;
17851
+ }
17852
+ /**
17853
+ * Mark position and patch `node.position`.
17854
+ */
17855
 
 
17856
 
17857
+ function position() {
17858
+ const start = {
17859
+ line: lineno,
17860
+ column
17861
+ };
17862
+ return function (node) {
17863
+ node.position = new Position(start);
17864
+ whitespace();
17865
+ return node;
17866
+ };
17867
+ }
17868
+ /**
17869
+ * Store position information for a node
17870
+ */
 
 
 
 
17871
 
 
 
 
17872
 
17873
+ function Position(start) {
17874
+ this.start = start;
17875
+ this.end = {
17876
+ line: lineno,
17877
+ column
17878
  };
17879
+ this.source = options.source;
 
17880
  }
17881
+ /**
17882
+ * Non-enumerable source string
17883
+ */
17884
 
 
 
17885
 
17886
+ Position.prototype.content = css;
17887
+ /**
17888
+ * Error `msg`.
17889
+ */
17890
 
17891
+ const errorsList = [];
 
 
 
 
 
17892
 
17893
+ function error(msg) {
17894
+ const err = new Error(options.source + ':' + lineno + ':' + column + ': ' + msg);
17895
+ err.reason = msg;
17896
+ err.filename = options.source;
17897
+ err.line = lineno;
17898
+ err.column = column;
17899
+ err.source = css;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17900
 
17901
+ if (options.silent) {
17902
+ errorsList.push(err);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17903
  } else {
17904
+ throw err;
 
 
 
 
 
 
 
 
 
 
 
 
17905
  }
17906
+ }
17907
+ /**
17908
+ * Parse stylesheet.
17909
+ */
17910
 
 
 
 
 
 
 
 
17911
 
17912
+ function stylesheet() {
17913
+ const rulesList = rules();
17914
+ return {
17915
+ type: 'stylesheet',
17916
+ stylesheet: {
17917
+ source: options.source,
17918
+ rules: rulesList,
17919
+ parsingErrors: errorsList
17920
  }
17921
+ };
17922
  }
17923
+ /**
17924
+ * Opening brace.
17925
+ */
17926
 
17927
+
17928
+ function open() {
17929
+ return match(/^{\s*/);
17930
  }
17931
+ /**
17932
+ * Closing brace.
17933
+ */
17934
 
 
 
 
 
 
 
 
 
 
 
 
17935
 
17936
+ function close() {
17937
+ return match(/^}/);
17938
+ }
17939
+ /**
17940
+ * Parse ruleset.
17941
+ */
17942
 
 
 
 
 
 
 
 
 
 
 
 
 
17943
 
17944
+ function rules() {
17945
+ let node;
17946
+ const accumulator = [];
17947
+ whitespace();
17948
+ comments(accumulator);
17949
 
17950
+ while (css.length && css.charAt(0) !== '}' && (node = atrule() || rule())) {
17951
+ if (node !== false) {
17952
+ accumulator.push(node);
17953
+ comments(accumulator);
17954
+ }
17955
  }
17956
 
17957
+ return accumulator;
17958
+ }
17959
+ /**
17960
+ * Match `re` and return captures.
17961
+ */
17962
 
 
 
 
 
 
 
17963
 
17964
+ function match(re) {
17965
+ const m = re.exec(css);
17966
 
17967
+ if (!m) {
17968
+ return;
17969
  }
17970
 
17971
+ const str = m[0];
17972
+ updatePosition(str);
17973
+ css = css.slice(str.length);
17974
+ return m;
17975
+ }
17976
+ /**
17977
+ * Parse whitespace.
17978
+ */
 
 
 
 
 
17979
 
 
 
17980
 
17981
+ function whitespace() {
17982
+ match(/^\s*/);
17983
+ }
17984
+ /**
17985
+ * Parse comments;
17986
+ */
17987
 
 
 
 
17988
 
17989
+ function comments(accumulator) {
17990
+ let c;
17991
+ accumulator = accumulator || []; // eslint-disable-next-line no-cond-assign
 
 
 
17992
 
17993
+ while (c = comment()) {
17994
+ if (c !== false) {
17995
+ accumulator.push(c);
17996
  }
17997
+ }
17998
 
17999
+ return accumulator;
18000
+ }
18001
+ /**
18002
+ * Parse comment.
18003
+ */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18004
 
 
 
 
 
 
18005
 
18006
+ function comment() {
18007
+ const pos = position();
18008
 
18009
+ if ('/' !== css.charAt(0) || '*' !== css.charAt(1)) {
18010
+ return;
18011
+ }
 
 
 
 
 
18012
 
18013
+ let i = 2;
 
 
 
 
 
 
 
 
 
18014
 
18015
+ while ('' !== css.charAt(i) && ('*' !== css.charAt(i) || '/' !== css.charAt(i + 1))) {
18016
+ ++i;
18017
+ }
18018
 
18019
+ i += 2;
 
 
 
 
 
 
 
18020
 
18021
+ if ('' === css.charAt(i - 1)) {
18022
+ return error('End of comment missing');
18023
+ }
 
18024
 
18025
+ const str = css.slice(2, i - 2);
18026
+ column += 2;
18027
+ updatePosition(str);
18028
+ css = css.slice(i);
18029
+ column += 2;
18030
+ return pos({
18031
+ type: 'comment',
18032
+ comment: str
18033
  });
18034
  }
18035
+ /**
18036
+ * Parse selector.
18037
+ */
18038
 
 
 
 
 
 
 
 
 
 
18039
 
18040
+ function selector() {
18041
+ const m = match(/^([^{]+)/);
18042
 
18043
+ if (!m) {
18044
+ return;
18045
+ } // FIXME: Remove all comments from selectors http://ostermiller.org/findcomment.html
 
 
 
 
18046
 
 
 
 
 
 
 
18047
 
18048
+ return trim(m[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, '').replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, function (matched) {
18049
+ return matched.replace(/,/g, '\u200C');
18050
+ }).split(/\s*(?![^(]*\)),\s*/).map(function (s) {
18051
+ return s.replace(/\u200C/g, ',');
18052
+ });
18053
+ }
18054
+ /**
18055
+ * Parse declaration.
18056
+ */
18057
 
 
 
18058
 
18059
+ function declaration() {
18060
+ const pos = position(); // prop
 
 
 
 
 
 
 
18061
 
18062
+ let prop = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);
18063
 
18064
+ if (!prop) {
18065
+ return;
18066
+ }
18067
 
18068
+ prop = trim(prop[0]); // :
 
18069
 
18070
+ if (!match(/^:\s*/)) {
18071
+ return error("property missing ':'");
18072
+ } // val
18073
 
 
 
18074
 
18075
+ const val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/);
18076
+ const ret = pos({
18077
+ type: 'declaration',
18078
+ property: prop.replace(commentre, ''),
18079
+ value: val ? trim(val[0]).replace(commentre, '') : ''
18080
+ }); // ;
18081
 
18082
+ match(/^[;\s]*/);
18083
+ return ret;
 
18084
  }
18085
+ /**
18086
+ * Parse declarations.
18087
+ */
18088
 
 
 
 
 
18089
 
18090
+ function declarations() {
18091
+ const decls = [];
 
 
 
 
18092
 
18093
+ if (!open()) {
18094
+ return error("missing '{'");
 
 
 
 
18095
  }
 
18096
 
18097
+ comments(decls); // declarations
 
 
 
 
 
18098
 
18099
+ let decl; // eslint-disable-next-line no-cond-assign
 
 
 
18100
 
18101
+ while (decl = declaration()) {
18102
+ if (decl !== false) {
18103
+ decls.push(decl);
18104
+ comments(decls);
18105
  }
18106
+ }
 
18107
 
18108
+ if (!close()) {
18109
+ return error("missing '}'");
18110
+ }
18111
+
18112
+ return decls;
18113
  }
18114
+ /**
18115
+ * Parse keyframe.
18116
+ */
18117
 
 
 
 
 
 
 
18118
 
18119
+ function keyframe() {
18120
+ let m;
18121
+ const vals = [];
18122
+ const pos = position(); // eslint-disable-next-line no-cond-assign
18123
 
18124
+ while (m = match(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/)) {
18125
+ vals.push(m[1]);
18126
+ match(/^,\s*/);
18127
+ }
18128
 
18129
+ if (!vals.length) {
18130
+ return;
18131
+ }
 
 
 
18132
 
18133
+ return pos({
18134
+ type: 'keyframe',
18135
+ values: vals,
18136
+ declarations: declarations()
18137
+ });
 
 
18138
  }
18139
+ /**
18140
+ * Parse keyframes.
18141
+ */
18142
 
 
18143
 
18144
+ function atkeyframes() {
18145
+ const pos = position();
18146
+ let m = match(/^@([-\w]+)?keyframes\s*/);
18147
 
18148
+ if (!m) {
18149
+ return;
18150
+ }
18151
 
18152
+ const vendor = m[1]; // identifier
 
 
 
 
 
 
 
 
 
 
 
18153
 
18154
+ m = match(/^([-\w]+)\s*/);
 
18155
 
18156
+ if (!m) {
18157
+ return error('@keyframes missing name');
18158
+ }
 
 
18159
 
18160
+ const name = m[1];
18161
 
18162
+ if (!open()) {
18163
+ return error("@keyframes missing '{'");
18164
+ }
18165
 
18166
+ let frame;
18167
+ let frames = comments(); // eslint-disable-next-line no-cond-assign
 
18168
 
18169
+ while (frame = keyframe()) {
18170
+ frames.push(frame);
18171
+ frames = frames.concat(comments());
18172
+ }
18173
 
18174
+ if (!close()) {
18175
+ return error("@keyframes missing '}'");
18176
+ }
18177
 
18178
+ return pos({
18179
+ type: 'keyframes',
18180
+ name,
18181
+ vendor,
18182
+ keyframes: frames
18183
+ });
18184
+ }
18185
+ /**
18186
+ * Parse supports.
18187
+ */
18188
 
18189
 
18190
+ function atsupports() {
18191
+ const pos = position();
18192
+ const m = match(/^@supports *([^{]+)/);
18193
 
18194
+ if (!m) {
18195
+ return;
18196
+ }
 
 
18197
 
18198
+ const supports = trim(m[1]);
 
 
 
 
18199
 
18200
+ if (!open()) {
18201
+ return error("@supports missing '{'");
18202
+ }
18203
 
18204
+ const style = comments().concat(rules());
 
18205
 
18206
+ if (!close()) {
18207
+ return error("@supports missing '}'");
18208
+ }
 
 
18209
 
18210
+ return pos({
18211
+ type: 'supports',
18212
+ supports,
18213
+ rules: style
18214
+ });
18215
  }
18216
+ /**
18217
+ * Parse host.
18218
+ */
18219
 
 
18220
 
18221
+ function athost() {
18222
+ const pos = position();
18223
+ const m = match(/^@host\s*/);
 
 
 
 
 
18224
 
18225
+ if (!m) {
18226
+ return;
18227
+ }
18228
 
18229
+ if (!open()) {
18230
+ return error("@host missing '{'");
18231
+ }
18232
 
18233
+ const style = comments().concat(rules());
 
 
18234
 
18235
+ if (!close()) {
18236
+ return error("@host missing '}'");
 
 
 
18237
  }
18238
+
18239
+ return pos({
18240
+ type: 'host',
18241
+ rules: style
18242
+ });
18243
  }
18244
+ /**
18245
+ * Parse media.
18246
+ */
18247
 
 
 
 
18248
 
18249
+ function atmedia() {
18250
+ const pos = position();
18251
+ const m = match(/^@media *([^{]+)/);
18252
 
18253
+ if (!m) {
18254
+ return;
18255
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18256
 
18257
+ const media = trim(m[1]);
18258
 
18259
+ if (!open()) {
18260
+ return error("@media missing '{'");
18261
+ }
 
 
18262
 
18263
+ const style = comments().concat(rules());
 
 
 
18264
 
18265
+ if (!close()) {
18266
+ return error("@media missing '}'");
18267
+ }
18268
 
18269
+ return pos({
18270
+ type: 'media',
18271
+ media,
18272
+ rules: style
18273
+ });
18274
+ }
18275
+ /**
18276
+ * Parse custom-media.
18277
+ */
18278
 
 
 
 
 
 
 
 
 
18279
 
18280
+ function atcustommedia() {
18281
+ const pos = position();
18282
+ const m = match(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);
18283
 
18284
+ if (!m) {
18285
+ return;
 
18286
  }
18287
 
18288
+ return pos({
18289
+ type: 'custom-media',
18290
+ name: trim(m[1]),
18291
+ media: trim(m[2])
 
 
 
 
 
 
 
18292
  });
18293
+ }
18294
+ /**
18295
+ * Parse paged media.
18296
+ */
18297
 
18298
+
18299
+ function atpage() {
18300
+ const pos = position();
18301
+ const m = match(/^@page */);
18302
+
18303
+ if (!m) {
18304
+ return;
18305
  }
18306
 
18307
+ const sel = selector() || [];
 
18308
 
18309
+ if (!open()) {
18310
+ return error("@page missing '{'");
18311
+ }
18312
 
18313
+ let decls = comments(); // declarations
 
 
 
 
 
 
18314
 
18315
+ let decl; // eslint-disable-next-line no-cond-assign
 
 
18316
 
18317
+ while (decl = declaration()) {
18318
+ decls.push(decl);
18319
+ decls = decls.concat(comments());
18320
+ }
18321
+
18322
+ if (!close()) {
18323
+ return error("@page missing '}'");
18324
+ }
18325
+
18326
+ return pos({
18327
+ type: 'page',
18328
+ selectors: sel,
18329
+ declarations: decls
18330
  });
 
18331
  }
18332
+ /**
18333
+ * Parse document.
18334
+ */
18335
 
 
 
 
18336
 
18337
+ function atdocument() {
18338
+ const pos = position();
18339
+ const m = match(/^@([-\w]+)?document *([^{]+)/);
18340
 
18341
+ if (!m) {
18342
+ return;
 
18343
  }
18344
 
18345
+ const vendor = trim(m[1]);
18346
+ const doc = trim(m[2]);
18347
 
18348
+ if (!open()) {
18349
+ return error("@document missing '{'");
18350
+ }
18351
 
18352
+ const style = comments().concat(rules());
18353
 
18354
+ if (!close()) {
18355
+ return error("@document missing '}'");
18356
+ }
 
 
 
 
 
 
 
 
18357
 
18358
+ return pos({
18359
+ type: 'document',
18360
+ document: doc,
18361
+ vendor,
18362
+ rules: style
18363
+ });
18364
  }
18365
+ /**
18366
+ * Parse font-face.
18367
+ */
18368
 
18369
 
18370
+ function atfontface() {
18371
+ const pos = position();
18372
+ const m = match(/^@font-face\s*/);
18373
 
18374
+ if (!m) {
18375
+ return;
18376
+ }
 
18377
 
18378
+ if (!open()) {
18379
+ return error("@font-face missing '{'");
18380
+ }
18381
 
18382
+ let decls = comments(); // declarations
18383
 
18384
+ let decl; // eslint-disable-next-line no-cond-assign
18385
 
18386
+ while (decl = declaration()) {
18387
+ decls.push(decl);
18388
+ decls = decls.concat(comments());
18389
+ }
18390
 
18391
+ if (!close()) {
18392
+ return error("@font-face missing '}'");
18393
+ }
 
 
 
18394
 
18395
+ return pos({
18396
+ type: 'font-face',
18397
+ declarations: decls
18398
+ });
18399
+ }
18400
+ /**
18401
+ * Parse import
18402
+ */
18403
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18404
 
18405
+ const atimport = _compileAtrule('import');
18406
+ /**
18407
+ * Parse charset
18408
+ */
18409
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18410
 
18411
+ const atcharset = _compileAtrule('charset');
18412
+ /**
18413
+ * Parse namespace
18414
+ */
18415
 
 
18416
 
18417
+ const atnamespace = _compileAtrule('namespace');
18418
+ /**
18419
+ * Parse non-block at-rules
18420
+ */
18421
 
 
 
 
 
18422
 
18423
+ function _compileAtrule(name) {
18424
+ const re = new RegExp('^@' + name + '\\s*([^;]+);');
18425
+ return function () {
18426
+ const pos = position();
18427
+ const m = match(re);
18428
+
18429
+ if (!m) {
18430
+ return;
18431
  }
18432
+
18433
+ const ret = {
18434
+ type: name
18435
+ };
18436
+ ret[name] = m[1].trim();
18437
+ return pos(ret);
18438
  };
18439
+ }
18440
+ /**
18441
+ * Parse at rule.
18442
+ */
18443
+
18444
+
18445
+ function atrule() {
18446
+ if (css[0] !== '@') {
18447
  return;
18448
  }
18449
 
18450
+ return atkeyframes() || atmedia() || atcustommedia() || atsupports() || atimport() || atcharset() || atnamespace() || atdocument() || atpage() || athost() || atfontface();
18451
+ }
18452
+ /**
18453
+ * Parse rule.
18454
+ */
18455
+
18456
+
18457
+ function rule() {
18458
+ const pos = position();
18459
+ const sel = selector();
18460
+
18461
+ if (!sel) {
18462
+ return error('selector missing');
18463
  }
18464
 
18465
+ comments();
18466
+ return pos({
18467
+ type: 'rule',
18468
+ selectors: sel,
18469
+ declarations: declarations()
 
18470
  });
18471
+ }
18472
 
18473
+ return addParent(stylesheet());
18474
+ }
18475
+ /**
18476
+ * Trim `str`.
18477
+ */
 
 
18478
 
18479
+ function trim(str) {
18480
+ return str ? str.replace(/^\s+|\s+$/g, '') : '';
18481
+ }
18482
+ /**
18483
+ * Adds non-enumerable parent node reference to each node.
18484
+ */
18485
 
18486
 
18487
+ function addParent(obj, parent) {
18488
+ const isNode = obj && typeof obj.type === 'string';
18489
+ const childParent = isNode ? obj : parent;
 
 
 
 
 
 
18490
 
18491
+ for (const k in obj) {
18492
+ const value = obj[k];
18493
+
18494
+ if (Array.isArray(value)) {
18495
+ value.forEach(function (v) {
18496
+ addParent(v, childParent);
18497
  });
18498
+ } else if (value && typeof value === 'object') {
18499
+ addParent(value, childParent);
18500
  }
18501
  }
18502
 
18503
+ if (isNode) {
18504
+ Object.defineProperty(obj, 'parent', {
18505
+ configurable: true,
18506
+ writable: true,
18507
+ enumerable: false,
18508
+ value: parent || null
18509
+ });
18510
+ }
18511
+
18512
+ return obj;
 
 
 
 
 
 
 
 
 
 
 
18513
  }
18514
+ /* eslint-enable @wordpress/no-unused-vars-before-return */
18515
+ //# sourceMappingURL=parse.js.map
18516
+ // EXTERNAL MODULE: ./node_modules/inherits/inherits_browser.js
18517
+ var inherits_browser = __webpack_require__(5717);
18518
+ var inherits_browser_default = /*#__PURE__*/__webpack_require__.n(inherits_browser);
18519
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/transform-styles/ast/stringify/compiler.js
18520
+ // Adapted from https://github.com/reworkcss/css
18521
+ // because we needed to remove source map support.
18522
 
 
 
 
 
 
18523
  /**
18524
+ * Expose `Compiler`.
18525
+ */
18526
+ /* harmony default export */ var compiler = (Compiler);
18527
+ /**
18528
+ * Initialize a compiler.
 
18529
  */
18530
 
18531
+ function Compiler(opts) {
18532
+ this.options = opts || {};
18533
  }
18534
  /**
18535
+ * Emit `str`
 
 
 
 
 
 
 
18536
  */
18537
 
18538
+
18539
+ Compiler.prototype.emit = function (str) {
18540
+ return str;
18541
+ };
18542
  /**
18543
+ * Visit `node`.
 
 
 
 
 
18544
  */
18545
 
 
 
 
 
18546
 
18547
+ Compiler.prototype.visit = function (node) {
18548
+ return this[node.type](node);
18549
+ };
18550
+ /**
18551
+ * Map visit over array of `nodes`, optionally using a `delim`
18552
+ */
18553
 
 
 
 
 
18554
 
18555
+ Compiler.prototype.mapVisit = function (nodes, delim) {
18556
+ let buf = '';
18557
+ delim = delim || '';
18558
+
18559
+ for (let i = 0, length = nodes.length; i < length; i++) {
18560
+ buf += this.visit(nodes[i]);
18561
+
18562
+ if (delim && i < length - 1) {
18563
+ buf += this.emit(delim);
18564
+ }
18565
  }
18566
 
18567
+ return buf;
18568
+ };
18569
+ //# sourceMappingURL=compiler.js.map
18570
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/transform-styles/ast/stringify/compress.js
18571
+ // Adapted from https://github.com/reworkcss/css
18572
+ // because we needed to remove source map support.
18573
+
18574
  /**
18575
  * External dependencies
18576
  */
18577
 
18578
  /**
18579
+ * Internal dependencies
18580
  */
18581
 
18582
 
 
 
18583
  /**
18584
+ * Expose compiler.
18585
  */
18586
 
18587
+ /* harmony default export */ var compress = (compress_Compiler);
18588
+ /**
18589
+ * Initialize a new `Compiler`.
18590
+ */
18591
 
18592
+ function compress_Compiler(options) {
18593
+ compiler.call(this, options);
18594
+ }
18595
  /**
18596
+ * Inherit from `Base.prototype`.
 
 
 
 
 
18597
  */
18598
 
 
 
 
 
 
 
 
 
18599
 
18600
+ inherits_browser_default()(compress_Compiler, compiler);
18601
+ /**
18602
+ * Compile `node`.
18603
+ */
18604
 
18605
+ compress_Compiler.prototype.compile = function (node) {
18606
+ return node.stylesheet.rules.map(this.visit, this).join('');
18607
+ };
18608
+ /**
18609
+ * Visit comment node.
18610
+ */
18611
 
18612
 
18613
+ compress_Compiler.prototype.comment = function (node) {
18614
+ return this.emit('', node.position);
18615
+ };
18616
  /**
18617
+ * Visit import node.
 
 
 
 
 
18618
  */
18619
 
18620
 
18621
+ compress_Compiler.prototype.import = function (node) {
18622
+ return this.emit('@import ' + node.import + ';', node.position);
18623
+ };
18624
+ /**
18625
+ * Visit media node.
18626
+ */
 
18627
 
 
 
 
18628
 
18629
+ compress_Compiler.prototype.media = function (node) {
18630
+ return this.emit('@media ' + node.media, node.position) + this.emit('{') + this.mapVisit(node.rules) + this.emit('}');
18631
+ };
18632
+ /**
18633
+ * Visit document node.
18634
+ */
18635
 
 
 
 
18636
 
18637
+ compress_Compiler.prototype.document = function (node) {
18638
+ const doc = '@' + (node.vendor || '') + 'document ' + node.document;
18639
+ return this.emit(doc, node.position) + this.emit('{') + this.mapVisit(node.rules) + this.emit('}');
18640
+ };
18641
+ /**
18642
+ * Visit charset node.
18643
+ */
18644
 
 
 
18645
 
18646
+ compress_Compiler.prototype.charset = function (node) {
18647
+ return this.emit('@charset ' + node.charset + ';', node.position);
18648
+ };
18649
+ /**
18650
+ * Visit namespace node.
18651
+ */
18652
 
 
 
 
 
18653
 
18654
+ compress_Compiler.prototype.namespace = function (node) {
18655
+ return this.emit('@namespace ' + node.namespace + ';', node.position);
18656
+ };
 
 
 
18657
  /**
18658
+ * Visit supports node.
18659
  */
18660
 
18661
 
18662
+ compress_Compiler.prototype.supports = function (node) {
18663
+ return this.emit('@supports ' + node.supports, node.position) + this.emit('{') + this.mapVisit(node.rules) + this.emit('}');
18664
+ };
18665
  /**
18666
+ * Visit keyframes node.
18667
  */
18668
 
18669
 
18670
+ compress_Compiler.prototype.keyframes = function (node) {
18671
+ return this.emit('@' + (node.vendor || '') + 'keyframes ' + node.name, node.position) + this.emit('{') + this.mapVisit(node.keyframes) + this.emit('}');
18672
+ };
 
 
 
 
 
 
 
18673
  /**
18674
+ * Visit keyframe node.
 
18675
  */
18676
 
18677
 
18678
+ compress_Compiler.prototype.keyframe = function (node) {
18679
+ const decls = node.declarations;
18680
+ return this.emit(node.values.join(','), node.position) + this.emit('{') + this.mapVisit(decls) + this.emit('}');
18681
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18682
  /**
18683
+ * Visit page node.
18684
  */
18685
 
18686
+
18687
+ compress_Compiler.prototype.page = function (node) {
18688
+ const sel = node.selectors.length ? node.selectors.join(', ') : '';
18689
+ return this.emit('@page ' + sel, node.position) + this.emit('{') + this.mapVisit(node.declarations) + this.emit('}');
18690
+ };
18691
  /**
18692
+ * Visit font-face node.
18693
  */
18694
 
18695
 
18696
+ compress_Compiler.prototype['font-face'] = function (node) {
18697
+ return this.emit('@font-face', node.position) + this.emit('{') + this.mapVisit(node.declarations) + this.emit('}');
18698
+ };
18699
  /**
18700
+ * Visit host node.
18701
  */
18702
 
18703
 
18704
+ compress_Compiler.prototype.host = function (node) {
18705
+ return this.emit('@host', node.position) + this.emit('{') + this.mapVisit(node.rules) + this.emit('}');
18706
+ };
18707
  /**
18708
+ * Visit custom-media node.
 
 
 
 
18709
  */
18710
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18711
 
18712
+ compress_Compiler.prototype['custom-media'] = function (node) {
18713
+ return this.emit('@custom-media ' + node.name + ' ' + node.media + ';', node.position);
18714
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18715
  /**
18716
+ * Visit rule node.
18717
  */
18718
 
18719
 
18720
+ compress_Compiler.prototype.rule = function (node) {
18721
+ const decls = node.declarations;
 
18722
 
18723
+ if (!decls.length) {
18724
+ return '';
18725
+ }
18726
 
18727
+ return this.emit(node.selectors.join(','), node.position) + this.emit('{') + this.mapVisit(decls) + this.emit('}');
18728
+ };
18729
  /**
18730
+ * Visit declaration node.
 
 
 
 
 
18731
  */
18732
 
 
 
 
 
 
18733
 
18734
+ compress_Compiler.prototype.declaration = function (node) {
18735
+ return this.emit(node.property + ':' + node.value, node.position) + this.emit(';');
18736
+ };
18737
+ //# sourceMappingURL=compress.js.map
18738
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/transform-styles/ast/stringify/identity.js
18739
+ /* eslint-disable @wordpress/no-unused-vars-before-return */
18740
+ // Adapted from https://github.com/reworkcss/css
18741
+ // because we needed to remove source map support.
18742
 
 
 
 
 
 
18743
  /**
18744
+ * External dependencies
18745
  */
18746
 
 
18747
  /**
18748
  * Internal dependencies
18749
  */
18750
 
18751
 
18752
  /**
18753
+ * Expose compiler.
 
 
 
 
18754
  */
18755
 
18756
+ /* harmony default export */ var identity = (identity_Compiler);
18757
+ /**
18758
+ * Initialize a new `Compiler`.
18759
+ */
 
 
 
 
 
 
 
 
 
 
18760
 
18761
+ function identity_Compiler(options) {
18762
+ options = options || {};
18763
+ compiler.call(this, options);
18764
+ this.indentation = options.indent;
18765
+ }
18766
+ /**
18767
+ * Inherit from `Base.prototype`.
18768
+ */
18769
 
 
 
 
18770
 
18771
+ inherits_browser_default()(identity_Compiler, compiler);
 
 
 
 
18772
  /**
18773
+ * Compile `node`.
18774
  */
18775
 
18776
+ identity_Compiler.prototype.compile = function (node) {
18777
+ return this.stylesheet(node);
18778
+ };
18779
  /**
18780
+ * Visit stylesheet node.
18781
  */
18782
 
18783
 
18784
+ identity_Compiler.prototype.stylesheet = function (node) {
18785
+ return this.mapVisit(node.stylesheet.rules, '\n\n');
18786
+ };
18787
  /**
18788
+ * Visit comment node.
18789
  */
18790
 
18791
 
18792
+ identity_Compiler.prototype.comment = function (node) {
18793
+ return this.emit(this.indent() + '/*' + node.comment + '*/', node.position);
18794
+ };
18795
  /**
18796
+ * Visit import node.
 
 
 
 
18797
  */
18798
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18799
 
18800
+ identity_Compiler.prototype.import = function (node) {
18801
+ return this.emit('@import ' + node.import + ';', node.position);
18802
+ };
18803
+ /**
18804
+ * Visit media node.
18805
+ */
18806
 
 
 
 
18807
 
18808
+ identity_Compiler.prototype.media = function (node) {
18809
+ return this.emit('@media ' + node.media, node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(node.rules, '\n\n') + this.emit(this.indent(-1) + '\n}');
18810
+ };
 
 
 
 
18811
  /**
18812
+ * Visit document node.
18813
  */
18814
 
18815
 
18816
+ identity_Compiler.prototype.document = function (node) {
18817
+ const doc = '@' + (node.vendor || '') + 'document ' + node.document;
18818
+ return this.emit(doc, node.position) + this.emit(' ' + ' {\n' + this.indent(1)) + this.mapVisit(node.rules, '\n\n') + this.emit(this.indent(-1) + '\n}');
18819
+ };
18820
  /**
18821
+ * Visit charset node.
18822
  */
18823
 
18824
 
18825
+ identity_Compiler.prototype.charset = function (node) {
18826
+ return this.emit('@charset ' + node.charset + ';', node.position);
18827
+ };
18828
  /**
18829
+ * Visit namespace node.
 
 
18830
  */
18831
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18832
 
18833
+ identity_Compiler.prototype.namespace = function (node) {
18834
+ return this.emit('@namespace ' + node.namespace + ';', node.position);
18835
+ };
18836
+ /**
18837
+ * Visit supports node.
18838
+ */
18839
 
18840
 
18841
+ identity_Compiler.prototype.supports = function (node) {
18842
+ return this.emit('@supports ' + node.supports, node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(node.rules, '\n\n') + this.emit(this.indent(-1) + '\n}');
18843
+ };
18844
+ /**
18845
+ * Visit keyframes node.
18846
+ */
18847
 
 
 
18848
 
18849
+ identity_Compiler.prototype.keyframes = function (node) {
18850
+ return this.emit('@' + (node.vendor || '') + 'keyframes ' + node.name, node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(node.keyframes, '\n') + this.emit(this.indent(-1) + '}');
18851
+ };
 
 
 
 
 
18852
  /**
18853
+ * Visit keyframe node.
18854
  */
18855
 
18856
 
18857
+ identity_Compiler.prototype.keyframe = function (node) {
18858
+ const decls = node.declarations;
18859
+ return this.emit(this.indent()) + this.emit(node.values.join(', '), node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(decls, '\n') + this.emit(this.indent(-1) + '\n' + this.indent() + '}\n');
18860
+ };
18861
+ /**
18862
+ * Visit page node.
18863
+ */
18864
 
18865
 
18866
+ identity_Compiler.prototype.page = function (node) {
18867
+ const sel = node.selectors.length ? node.selectors.join(', ') + ' ' : '';
18868
+ return this.emit('@page ' + sel, node.position) + this.emit('{\n') + this.emit(this.indent(1)) + this.mapVisit(node.declarations, '\n') + this.emit(this.indent(-1)) + this.emit('\n}');
18869
+ };
18870
  /**
18871
+ * Visit font-face node.
18872
  */
18873
 
18874
 
18875
+ identity_Compiler.prototype['font-face'] = function (node) {
18876
+ return this.emit('@font-face ', node.position) + this.emit('{\n') + this.emit(this.indent(1)) + this.mapVisit(node.declarations, '\n') + this.emit(this.indent(-1)) + this.emit('\n}');
18877
+ };
18878
  /**
18879
+ * Visit host node.
 
 
 
 
 
18880
  */
18881
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18882
 
18883
+ identity_Compiler.prototype.host = function (node) {
18884
+ return this.emit('@host', node.position) + this.emit(' {\n' + this.indent(1)) + this.mapVisit(node.rules, '\n\n') + this.emit(this.indent(-1) + '\n}');
18885
+ };
18886
+ /**
18887
+ * Visit custom-media node.
18888
+ */
18889
 
 
 
 
 
 
18890
 
18891
+ identity_Compiler.prototype['custom-media'] = function (node) {
18892
+ return this.emit('@custom-media ' + node.name + ' ' + node.media + ';', node.position);
18893
+ };
18894
+ /**
18895
+ * Visit rule node.
18896
+ */
18897
 
 
 
 
18898
 
18899
+ identity_Compiler.prototype.rule = function (node) {
18900
+ const indent = this.indent();
18901
+ const decls = node.declarations;
18902
 
18903
+ if (!decls.length) {
18904
+ return '';
18905
+ }
 
 
 
 
 
 
 
 
 
18906
 
18907
+ return this.emit(node.selectors.map(function (s) {
18908
+ return indent + s;
18909
+ }).join(',\n'), node.position) + this.emit(' {\n') + this.emit(this.indent(1)) + this.mapVisit(decls, '\n') + this.emit(this.indent(-1)) + this.emit('\n' + this.indent() + '}');
18910
+ };
18911
+ /**
18912
+ * Visit declaration node.
18913
+ */
18914
 
 
 
 
18915
 
18916
+ identity_Compiler.prototype.declaration = function (node) {
18917
+ return this.emit(this.indent()) + this.emit(node.property + ': ' + node.value, node.position) + this.emit(';');
18918
+ };
 
 
 
 
 
 
 
18919
  /**
18920
+ * Increase, decrease or return current indentation.
18921
  */
18922
 
18923
 
18924
+ identity_Compiler.prototype.indent = function (level) {
18925
+ this.level = this.level || 1;
18926
+
18927
+ if (null !== level) {
18928
+ this.level += level;
18929
+ return '';
18930
+ }
18931
+
18932
+ return Array(this.level).join(this.indentation || ' ');
18933
+ };
18934
+ /* eslint-enable @wordpress/no-unused-vars-before-return */
18935
+ //# sourceMappingURL=identity.js.map
18936
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/transform-styles/ast/stringify/index.js
18937
+ // Adapted from https://github.com/reworkcss/css
18938
+ // because we needed to remove source map support.
18939
+
18940
  /**
18941
  * Internal dependencies
18942
  */
18943
 
18944
 
18945
  /**
18946
+ * Stringfy the given AST `node`.
18947
  *
18948
+ * Options:
18949
+ *
18950
+ * - `compress` space-optimized output
18951
+ * - `sourcemap` return an object with `.code` and `.map`
18952
+ *
18953
+ * @param {Object} node
18954
+ * @param {Object} [options]
18955
+ * @return {string}
18956
  */
18957
 
18958
+ /* harmony default export */ function stringify(node, options) {
18959
+ options = options || {};
18960
+ const compiler = options.compress ? new compress(options) : new identity(options);
18961
+ const code = compiler.compile(node);
18962
+ return code;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18963
  }
18964
+ //# sourceMappingURL=index.js.map
18965
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/transform-styles/traverse.js
 
 
 
18966
  /**
18967
  * External dependencies
18968
  */
18969
 
18970
  /**
18971
+ * Internal dependencies
18972
  */
18973
 
 
 
 
18974
 
18975
 
18976
+ function traverseCSS(css, callback) {
18977
+ try {
18978
+ const parsed = parse(css);
18979
+ const updated = traverse_default().map(parsed, function (node) {
18980
+ if (!node) {
18981
+ return node;
18982
+ }
18983
 
18984
+ const updatedNode = callback(node);
18985
+ return this.update(updatedNode);
18986
+ });
18987
+ return stringify(updated);
18988
+ } catch (err) {
18989
+ // eslint-disable-next-line no-console
18990
+ console.warn('Error while traversing the CSS: ' + err);
18991
+ return null;
18992
+ }
18993
+ }
18994
 
18995
+ /* harmony default export */ var transform_styles_traverse = (traverseCSS);
18996
+ //# sourceMappingURL=traverse.js.map
18997
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/transform-styles/transforms/url-rewrite.js
18998
  /**
18999
+ * Return `true` if the given path is http/https.
19000
+ *
19001
+ * @param {string} filePath path
19002
+ *
19003
+ * @return {boolean} is remote path.
19004
+ */
19005
+ function isRemotePath(filePath) {
19006
+ return /^(?:https?:)?\/\//.test(filePath);
19007
+ }
19008
+ /**
19009
+ * Return `true` if the given filePath is an absolute url.
19010
+ *
19011
+ * @param {string} filePath path
19012
+ *
19013
+ * @return {boolean} is absolute path.
19014
  */
19015
 
19016
 
19017
+ function isAbsolutePath(filePath) {
19018
+ return /^\/(?!\/)/.test(filePath);
19019
+ }
19020
+ /**
19021
+ * Whether or not the url should be inluded.
19022
+ *
19023
+ * @param {Object} meta url meta info
19024
+ *
19025
+ * @return {boolean} is valid.
19026
+ */
 
 
 
 
 
 
 
 
19027
 
 
 
 
 
19028
 
19029
+ function isValidURL(meta) {
19030
+ // ignore hashes or data uris
19031
+ if (meta.value.indexOf('data:') === 0 || meta.value.indexOf('#') === 0) {
19032
+ return false;
19033
+ }
19034
 
19035
+ if (isAbsolutePath(meta.value)) {
19036
+ return false;
19037
+ } // do not handle the http/https urls if `includeRemote` is false
19038
 
 
 
19039
 
19040
+ if (isRemotePath(meta.value)) {
19041
+ return false;
19042
+ }
19043
 
19044
+ return true;
 
 
 
 
19045
  }
 
 
19046
  /**
19047
+ * Get the absolute path of the url, relative to the basePath
19048
+ *
19049
+ * @param {string} str the url
19050
+ * @param {string} baseURL base URL
19051
+ *
19052
+ * @return {string} the full path to the file
19053
  */
19054
 
19055
 
19056
+ function getResourcePath(str, baseURL) {
19057
+ return new URL(str, baseURL).toString();
19058
+ }
19059
  /**
19060
+ * Process the single `url()` pattern
19061
+ *
19062
+ * @param {string} baseURL the base URL for relative URLs.
19063
+ *
19064
+ * @return {Promise} the Promise.
19065
  */
19066
 
19067
 
19068
+ function processURL(baseURL) {
19069
+ return meta => ({ ...meta,
19070
+ newUrl: 'url(' + meta.before + meta.quote + getResourcePath(meta.value, baseURL) + meta.quote + meta.after + ')'
 
 
 
 
 
 
19071
  });
19072
  }
19073
  /**
19074
+ * Get all `url()`s, and return the meta info
19075
  *
19076
+ * @param {string} value decl.value.
19077
+ *
19078
+ * @return {Array} the urls.
19079
  */
19080
 
19081
 
19082
+ function getURLs(value) {
19083
+ const reg = /url\((\s*)(['"]?)(.+?)\2(\s*)\)/g;
19084
+ let match;
19085
+ const URLs = [];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19086
 
19087
+ while ((match = reg.exec(value)) !== null) {
19088
+ const meta = {
19089
+ source: match[0],
19090
+ before: match[1],
19091
+ quote: match[2],
19092
+ value: match[3],
19093
+ after: match[4]
19094
+ };
19095
 
19096
+ if (isValidURL(meta)) {
19097
+ URLs.push(meta);
 
 
 
 
 
 
 
 
 
19098
  }
19099
+ }
19100
 
19101
+ return URLs;
19102
+ }
19103
+ /**
19104
+ * Replace the raw value's `url()` segment to the new value
19105
+ *
19106
+ * @param {string} raw the raw value.
19107
+ * @param {Array} URLs the URLs to replace.
19108
+ *
19109
+ * @return {string} the new value.
19110
+ */
19111
 
 
 
 
19112
 
19113
+ function replaceURLs(raw, URLs) {
19114
+ URLs.forEach(item => {
19115
+ raw = raw.replace(item.source, item.newUrl);
19116
+ });
19117
+ return raw;
19118
+ }
 
19119
 
19120
+ const rewrite = rootURL => node => {
19121
+ if (node.type === 'declaration') {
19122
+ const updatedURLs = getURLs(node.value).map(processURL(rootURL));
19123
+ return { ...node,
19124
+ value: replaceURLs(node.value, updatedURLs)
19125
+ };
19126
+ }
 
19127
 
19128
+ return node;
19129
+ };
 
19130
 
19131
+ /* harmony default export */ var url_rewrite = (rewrite);
19132
+ //# sourceMappingURL=url-rewrite.js.map
19133
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/transform-styles/transforms/wrap.js
19134
+ /**
19135
+ * @constant string IS_ROOT_TAG Regex to check if the selector is a root tag selector.
19136
+ */
19137
+ const IS_ROOT_TAG = /^(body|html|:root).*$/;
19138
+ /**
19139
+ * Creates a callback to modify selectors so they only apply within a certain
19140
+ * namespace.
19141
+ *
19142
+ * @param {string} namespace Namespace to prefix selectors with.
19143
+ * @param {string[]} ignore Selectors to not prefix.
19144
+ *
19145
+ * @return {(node: Object) => Object} Callback to wrap selectors.
19146
+ */
19147
 
19148
+ const wrap = (namespace, ignore = []) => node => {
19149
+ /**
19150
+ * Updates selector if necessary.
19151
+ *
19152
+ * @param {string} selector Selector to modify.
19153
+ *
19154
+ * @return {string} Updated selector.
19155
+ */
19156
+ const updateSelector = selector => {
19157
+ if (ignore.includes(selector.trim())) {
19158
+ return selector;
19159
+ } // Anything other than a root tag is always prefixed.
19160
 
 
 
19161
 
19162
+ {
19163
+ if (!selector.match(IS_ROOT_TAG)) {
19164
+ return namespace + ' ' + selector;
 
 
19165
  }
19166
+ } // HTML and Body elements cannot be contained within our container so lets extract their styles.
19167
 
19168
+ return selector.replace(/^(body|html|:root)/, namespace);
19169
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19170
 
19171
+ if (node.type === 'rule') {
19172
+ return { ...node,
19173
+ selectors: node.selectors.map(updateSelector)
 
 
 
 
 
19174
  };
19175
+ }
 
 
 
 
 
 
 
 
 
 
 
19176
 
19177
+ return node;
19178
+ };
19179
 
19180
+ /* harmony default export */ var transforms_wrap = (wrap);
19181
+ //# sourceMappingURL=wrap.js.map
19182
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/transform-styles/index.js
 
 
 
 
 
 
 
 
 
 
19183
  /**
19184
  * External dependencies
19185
  */
19189
  */
19190
 
19191
 
 
 
 
 
 
19192
  /**
19193
  * Internal dependencies
19194
  */
19196
 
19197
 
19198
 
19199
+ /**
19200
+ * Applies a series of CSS rule transforms to wrap selectors inside a given class and/or rewrite URLs depending on the parameters passed.
19201
+ *
19202
+ * @param {Array} styles CSS rules.
19203
+ * @param {string} wrapperClassName Wrapper Class Name.
19204
+ * @return {Array} converted rules.
19205
+ */
19206
 
19207
+ const transformStyles = (styles, wrapperClassName = '') => {
19208
+ return (0,external_lodash_namespaceObject.map)(styles, ({
19209
+ css,
19210
+ baseURL,
19211
+ __experimentalNoWrapper = false
19212
+ }) => {
19213
+ const transforms = [];
19214
 
19215
+ if (wrapperClassName && !__experimentalNoWrapper) {
19216
+ transforms.push(transforms_wrap(wrapperClassName));
19217
+ }
19218
 
19219
+ if (baseURL) {
19220
+ transforms.push(url_rewrite(baseURL));
19221
+ }
19222
 
19223
+ if (transforms.length) {
19224
+ return transform_styles_traverse(css, (0,external_wp_compose_namespaceObject.compose)(transforms));
19225
+ }
19226
 
19227
+ return css;
19228
+ });
19229
+ };
19230
 
19231
+ /* harmony default export */ var transform_styles = (transformStyles);
19232
+ //# sourceMappingURL=index.js.map
19233
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/editor-styles/index.js
19234
 
19235
 
19236
+ /**
19237
+ * External dependencies
19238
+ */
19239
 
19240
 
19241
 
19242
  /**
19243
+ * WordPress dependencies
 
19244
  */
19245
 
19246
+
19247
  /**
19248
+ * Internal dependencies
 
 
 
 
 
 
 
 
 
 
 
 
 
19249
  */
19250
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19251
 
19252
+ const EDITOR_STYLES_SELECTOR = '.editor-styles-wrapper';
19253
+ k([names, a11y]);
 
 
 
 
 
 
 
 
19254
 
19255
+ function useDarkThemeBodyClassName(styles) {
19256
+ return (0,external_wp_element_namespaceObject.useCallback)(node => {
19257
+ if (!node) {
19258
+ return;
19259
+ }
19260
+
19261
+ const {
19262
+ ownerDocument
19263
+ } = node;
19264
+ const {
19265
+ defaultView,
19266
+ body
19267
+ } = ownerDocument;
19268
+ const canvas = ownerDocument.querySelector(EDITOR_STYLES_SELECTOR);
19269
+ let backgroundColor;
19270
+
19271
+ if (!canvas) {
19272
+ // The real .editor-styles-wrapper element might not exist in the
19273
+ // DOM, so calculate the background color by creating a fake
19274
+ // wrapper.
19275
+ const tempCanvas = ownerDocument.createElement('div');
19276
+ tempCanvas.classList.add('editor-styles-wrapper');
19277
+ body.appendChild(tempCanvas);
19278
+ backgroundColor = defaultView.getComputedStyle(tempCanvas, null).getPropertyValue('background-color');
19279
+ body.removeChild(tempCanvas);
19280
+ } else {
19281
+ backgroundColor = defaultView.getComputedStyle(canvas, null).getPropertyValue('background-color');
19282
+ }
19283
 
19284
+ const colordBackgroundColor = w(backgroundColor); // If background is transparent, it should be treated as light color.
19285
+
19286
+ if (colordBackgroundColor.luminance() > 0.5 || colordBackgroundColor.alpha() === 0) {
19287
+ body.classList.remove('is-dark-theme');
19288
+ } else {
19289
+ body.classList.add('is-dark-theme');
 
 
 
 
 
 
 
 
 
 
19290
  }
19291
+ }, [styles]);
19292
  }
 
 
 
 
 
19293
 
19294
+ function EditorStyles({
19295
+ styles
19296
+ }) {
19297
+ const transformedStyles = (0,external_wp_element_namespaceObject.useMemo)(() => transform_styles(styles, EDITOR_STYLES_SELECTOR), [styles]);
19298
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("style", {
19299
+ ref: useDarkThemeBodyClassName(styles)
19300
+ }), transformedStyles.map((css, index) => (0,external_wp_element_namespaceObject.createElement)("style", {
19301
+ key: index
19302
+ }, css)));
19303
+ }
19304
  //# sourceMappingURL=index.js.map
19305
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-preview/auto.js
 
 
 
 
 
19306
 
19307
 
19308
  /**
19311
 
19312
 
19313
 
 
 
 
 
19314
  /**
19315
  * Internal dependencies
19316
  */
19318
 
19319
 
19320
 
19321
+ // This is used to avoid rendering the block list if the sizes change.
19322
+
19323
+ let MemoizedBlockList;
19324
+
19325
+ function AutoBlockPreview({
19326
+ viewportWidth,
19327
+ __experimentalPadding
19328
+ }) {
19329
+ const [containerResizeListener, {
19330
+ width: containerWidth
19331
+ }] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
19332
+ const [contentResizeListener, {
19333
+ height: contentHeight
19334
+ }] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
19335
+ const styles = (0,external_wp_data_namespaceObject.useSelect)(select => {
19336
+ return select(store).getSettings().styles;
19337
+ }, []); // Initialize on render instead of module top level, to avoid circular dependency issues.
19338
 
19339
+ MemoizedBlockList = MemoizedBlockList || (0,external_wp_compose_namespaceObject.pure)(BlockList);
19340
+ const scale = containerWidth / viewportWidth;
19341
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
19342
+ className: "block-editor-block-preview__container"
19343
+ }, containerResizeListener, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Disabled, {
19344
+ className: "block-editor-block-preview__content",
19345
+ style: {
19346
+ transform: `scale(${scale})`,
19347
+ height: contentHeight * scale
19348
+ }
19349
+ }, (0,external_wp_element_namespaceObject.createElement)(iframe, {
19350
+ head: (0,external_wp_element_namespaceObject.createElement)(EditorStyles, {
19351
+ styles: styles
19352
+ }),
19353
+ contentRef: (0,external_wp_compose_namespaceObject.useRefEffect)(bodyElement => {
19354
+ const {
19355
+ ownerDocument: {
19356
+ documentElement
19357
+ }
19358
+ } = bodyElement;
19359
+ documentElement.style.position = 'absolute';
19360
+ documentElement.style.width = '100%';
19361
+ bodyElement.style.padding = __experimentalPadding + 'px';
19362
+ }, []),
19363
+ "aria-hidden": true,
19364
+ tabIndex: -1,
19365
+ style: {
19366
+ position: 'absolute',
19367
+ width: viewportWidth,
19368
+ height: contentHeight,
19369
+ pointerEvents: 'none'
19370
+ }
19371
+ }, contentResizeListener, (0,external_wp_element_namespaceObject.createElement)(MemoizedBlockList, {
19372
+ renderAppender: false
19373
+ }))));
19374
+ }
19375
 
19376
+ /* harmony default export */ var auto = (AutoBlockPreview);
19377
+ //# sourceMappingURL=auto.js.map
19378
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-preview/index.js
19379
 
19380
 
 
19381
  /**
19382
+ * External dependencies
 
 
 
 
 
19383
  */
19384
 
19385
+ /**
19386
+ * WordPress dependencies
19387
+ */
 
 
 
 
 
 
 
 
 
 
 
19388
 
 
 
19389
 
 
 
 
 
 
 
 
 
 
19390
 
19391
+ /**
19392
+ * Internal dependencies
19393
+ */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19394
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19395
 
 
 
 
19396
 
 
 
19397
 
 
 
 
 
 
 
19398
 
19399
+ function BlockPreview({
19400
+ blocks,
19401
+ __experimentalPadding = 0,
19402
+ viewportWidth = 1200,
19403
+ __experimentalLive = false,
19404
+ __experimentalOnClick
19405
+ }) {
19406
+ const originalSettings = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings(), []);
19407
+ const settings = (0,external_wp_element_namespaceObject.useMemo)(() => {
19408
+ const _settings = { ...originalSettings
19409
+ };
19410
+ _settings.__experimentalBlockPatterns = [];
19411
+ return _settings;
19412
+ }, [originalSettings]);
19413
+ const renderedBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_lodash_namespaceObject.castArray)(blocks), [blocks]);
19414
 
19415
+ if (!blocks || blocks.length === 0) {
19416
+ return null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19417
  }
19418
 
19419
+ return (0,external_wp_element_namespaceObject.createElement)(provider, {
19420
+ value: renderedBlocks,
19421
+ settings: settings
19422
+ }, __experimentalLive ? (0,external_wp_element_namespaceObject.createElement)(LiveBlockPreview, {
19423
+ onClick: __experimentalOnClick
19424
+ }) : (0,external_wp_element_namespaceObject.createElement)(auto, {
19425
+ viewportWidth: viewportWidth,
19426
+ __experimentalPadding: __experimentalPadding
19427
+ }));
 
 
 
 
 
19428
  }
19429
+ /**
19430
+ * BlockPreview renders a preview of a block or array of blocks.
19431
+ *
19432
+ * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-preview/README.md
19433
+ *
19434
+ * @param {Object} preview options for how the preview should be shown
19435
+ * @param {Array|Object} preview.blocks A block instance (object) or an array of blocks to be previewed.
19436
+ * @param {number} preview.viewportWidth Width of the preview container in pixels. Controls at what size the blocks will be rendered inside the preview. Default: 700.
19437
+ *
19438
+ * @return {WPComponent} The component to be rendered.
19439
+ */
19440
 
19441
+ /* harmony default export */ var block_preview = ((0,external_wp_element_namespaceObject.memo)(BlockPreview));
19442
+ //# sourceMappingURL=index.js.map
19443
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/preview-panel.js
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19444
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19445
 
19446
+ /**
19447
+ * WordPress dependencies
19448
+ */
 
 
 
 
 
 
 
 
 
19449
 
 
 
 
 
 
 
19450
 
19451
+ /**
19452
+ * Internal dependencies
19453
+ */
 
 
 
 
 
 
 
 
19454
 
 
 
 
 
 
 
 
 
19455
 
 
 
19456
 
 
 
 
 
 
19457
 
19458
+ function InserterPreviewPanel({
19459
+ item
19460
+ }) {
19461
+ var _hoveredItemBlockType, _hoveredItemBlockType2;
 
19462
 
19463
+ const {
19464
+ name,
19465
+ title,
19466
+ icon,
19467
+ description,
19468
+ initialAttributes
19469
+ } = item;
19470
+ const hoveredItemBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
19471
+ const isReusable = (0,external_wp_blocks_namespaceObject.isReusableBlock)(item);
19472
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
19473
+ className: "block-editor-inserter__preview-container"
19474
+ }, (0,external_wp_element_namespaceObject.createElement)("div", {
19475
+ className: "block-editor-inserter__preview"
19476
+ }, isReusable || hoveredItemBlockType !== null && hoveredItemBlockType !== void 0 && hoveredItemBlockType.example ? (0,external_wp_element_namespaceObject.createElement)("div", {
19477
+ className: "block-editor-inserter__preview-content"
19478
+ }, (0,external_wp_element_namespaceObject.createElement)(block_preview, {
19479
+ __experimentalPadding: 16,
19480
+ viewportWidth: (_hoveredItemBlockType = (_hoveredItemBlockType2 = hoveredItemBlockType.example) === null || _hoveredItemBlockType2 === void 0 ? void 0 : _hoveredItemBlockType2.viewportWidth) !== null && _hoveredItemBlockType !== void 0 ? _hoveredItemBlockType : 500,
19481
+ blocks: hoveredItemBlockType.example ? (0,external_wp_blocks_namespaceObject.getBlockFromExample)(item.name, {
19482
+ attributes: { ...hoveredItemBlockType.example.attributes,
19483
+ ...initialAttributes
19484
+ },
19485
+ innerBlocks: hoveredItemBlockType.example.innerBlocks
19486
+ }) : (0,external_wp_blocks_namespaceObject.createBlock)(name, initialAttributes)
19487
+ })) : (0,external_wp_element_namespaceObject.createElement)("div", {
19488
+ className: "block-editor-inserter__preview-content-missing"
19489
+ }, (0,external_wp_i18n_namespaceObject.__)('No Preview Available.'))), !isReusable && (0,external_wp_element_namespaceObject.createElement)(block_card, {
19490
+ title: title,
19491
+ icon: icon,
19492
+ description: description
19493
+ }));
19494
+ }
19495
 
19496
+ /* harmony default export */ var preview_panel = (InserterPreviewPanel);
19497
+ //# sourceMappingURL=preview-panel.js.map
19498
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter-listbox/context.js
19499
+ /**
19500
+ * WordPress dependencies
19501
+ */
19502
 
19503
+ const InserterListboxContext = (0,external_wp_element_namespaceObject.createContext)();
19504
+ /* harmony default export */ var context = (InserterListboxContext);
19505
+ //# sourceMappingURL=context.js.map
19506
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter-listbox/item.js
19507
 
 
 
 
 
 
 
 
 
 
 
 
 
19508
 
19509
 
19510
  /**
19511
  * WordPress dependencies
19512
  */
19513
 
 
 
 
 
 
 
 
 
 
 
19514
 
19515
  /**
19516
+ * Internal dependencies
19517
  */
19518
 
19519
 
19520
 
19521
+ function InserterListboxItem({
19522
+ isFirst,
19523
+ as: Component,
19524
+ children,
19525
+ ...props
19526
+ }, ref) {
19527
+ const state = (0,external_wp_element_namespaceObject.useContext)(context);
19528
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableCompositeItem, _extends({
19529
+ ref: ref,
19530
+ state: state,
19531
+ role: "option" // Use the CompositeItem `focusable` prop over Button's
19532
+ // isFocusable. The latter was shown to cause an issue
19533
+ // with tab order in the inserter list.
19534
+ ,
19535
+ focusable: true
19536
+ }, props), htmlProps => {
19537
+ const propsWithTabIndex = { ...htmlProps,
19538
+ tabIndex: isFirst ? 0 : htmlProps.tabIndex
19539
+ };
19540
 
19541
+ if (Component) {
19542
+ return (0,external_wp_element_namespaceObject.createElement)(Component, propsWithTabIndex, children);
19543
+ }
 
 
 
19544
 
19545
+ if (typeof children === 'function') {
19546
+ return children(propsWithTabIndex);
19547
+ }
19548
+
19549
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, propsWithTabIndex, children);
19550
+ });
19551
+ }
19552
+
19553
+ /* harmony default export */ var inserter_listbox_item = ((0,external_wp_element_namespaceObject.forwardRef)(InserterListboxItem));
19554
+ //# sourceMappingURL=item.js.map
19555
+ ;// CONCATENATED MODULE: ./packages/icons/build-module/library/drag-handle.js
19556
 
19557
 
19558
  /**
19559
  * WordPress dependencies
19560
  */
19561
 
19562
+ const dragHandle = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
19563
+ width: "18",
19564
+ height: "18",
19565
  xmlns: "http://www.w3.org/2000/svg",
19566
+ viewBox: "0 0 18 18"
19567
  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
19568
+ d: "M5 4h2V2H5v2zm6-2v2h2V2h-2zm-6 8h2V8H5v2zm6 0h2V8h-2v2zm-6 6h2v-2H5v2zm6 0h2v-2h-2v2z"
19569
  }));
19570
+ /* harmony default export */ var drag_handle = (dragHandle);
19571
+ //# sourceMappingURL=drag-handle.js.map
19572
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-draggable/draggable-chip.js
 
19573
 
 
 
 
19574
 
19575
  /**
19576
  * WordPress dependencies
19578
 
19579
 
19580
 
19581
+ /**
19582
+ * Internal dependencies
19583
+ */
 
 
 
19584
 
 
 
 
 
 
19585
 
19586
+ function BlockDraggableChip({
19587
+ count,
19588
+ icon
19589
+ }) {
19590
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
19591
+ className: "block-editor-block-draggable-chip-wrapper"
19592
+ }, (0,external_wp_element_namespaceObject.createElement)("div", {
19593
+ className: "block-editor-block-draggable-chip"
19594
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
19595
+ justify: "center",
19596
+ className: "block-editor-block-draggable-chip__content"
19597
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, icon ? (0,external_wp_element_namespaceObject.createElement)(BlockIcon, {
19598
+ icon: icon
19599
+ }) : (0,external_wp_i18n_namespaceObject.sprintf)(
19600
+ /* translators: %d: Number of blocks. */
19601
+ (0,external_wp_i18n_namespaceObject._n)('%d block', '%d blocks', count), count)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(BlockIcon, {
19602
+ icon: drag_handle
19603
+ })))));
19604
  }
19605
+ //# sourceMappingURL=draggable-chip.js.map
19606
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter-draggable-blocks/index.js
19607
 
19608
 
19609
  /**
19616
 
19617
 
19618
 
19619
+ const InserterDraggableBlocks = ({
19620
+ isEnabled,
19621
+ blocks,
19622
  icon,
19623
+ children
19624
+ }) => {
19625
+ const transferData = {
19626
+ type: 'inserter',
19627
+ blocks
19628
+ };
19629
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Draggable, {
19630
+ __experimentalTransferDataType: "wp-blocks",
19631
+ transferData: transferData,
19632
+ __experimentalDragComponent: (0,external_wp_element_namespaceObject.createElement)(BlockDraggableChip, {
19633
+ count: blocks.length,
19634
+ icon: icon
19635
+ })
19636
+ }, ({
19637
+ onDraggableStart,
19638
+ onDraggableEnd
19639
+ }) => {
19640
+ return children({
19641
+ draggable: isEnabled,
19642
+ onDragStart: isEnabled ? onDraggableStart : undefined,
19643
+ onDragEnd: isEnabled ? onDraggableEnd : undefined
19644
  });
19645
+ });
19646
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19647
 
19648
+ /* harmony default export */ var inserter_draggable_blocks = (InserterDraggableBlocks);
19649
  //# sourceMappingURL=index.js.map
19650
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter-list-item/index.js
19651
 
19652
 
19653
 
19654
+ /**
19655
+ * External dependencies
19656
+ */
19657
+
19658
  /**
19659
  * WordPress dependencies
19660
  */
19661
 
19662
 
19663
 
19664
+
19665
  /**
19666
  * Internal dependencies
19667
  */
19668
 
19669
 
19670
 
 
 
 
 
 
 
 
 
 
 
 
19671
 
19672
+ /**
19673
+ * Return true if platform is MacOS.
19674
+ *
19675
+ * @param {Object} _window window object by default; used for DI testing.
19676
+ *
19677
+ * @return {boolean} True if MacOS; false otherwise.
19678
+ */
19679
 
19680
+ function isAppleOS(_window = window) {
19681
+ const {
19682
+ platform
19683
+ } = _window.navigator;
19684
+ return platform.indexOf('Mac') !== -1 || ['iPad', 'iPhone'].includes(platform);
19685
+ }
19686
+
19687
+ function InserterListItem({
19688
+ className,
19689
+ isFirst,
19690
+ item,
19691
+ onSelect,
19692
+ onHover,
19693
+ isDraggable,
19694
+ ...props
19695
+ }) {
19696
+ const isDragging = (0,external_wp_element_namespaceObject.useRef)(false);
19697
+ const itemIconStyle = item.icon ? {
19698
+ backgroundColor: item.icon.background,
19699
+ color: item.icon.foreground
19700
+ } : {};
19701
+ const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => {
19702
+ return [(0,external_wp_blocks_namespaceObject.createBlock)(item.name, item.initialAttributes, (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(item.innerBlocks))];
19703
+ }, [item.name, item.initialAttributes, item.initialAttributes]);
19704
+ return (0,external_wp_element_namespaceObject.createElement)(inserter_draggable_blocks, {
19705
+ isEnabled: isDraggable && !item.disabled,
19706
+ blocks: blocks,
19707
+ icon: item.icon
19708
+ }, ({
19709
+ draggable,
19710
+ onDragStart,
19711
+ onDragEnd
19712
+ }) => (0,external_wp_element_namespaceObject.createElement)("div", {
19713
+ className: "block-editor-block-types-list__list-item",
19714
+ draggable: draggable,
19715
+ onDragStart: event => {
19716
+ isDragging.current = true;
19717
+
19718
+ if (onDragStart) {
19719
+ onHover(null);
19720
+ onDragStart(event);
19721
+ }
19722
+ },
19723
+ onDragEnd: event => {
19724
+ isDragging.current = false;
19725
+
19726
+ if (onDragEnd) {
19727
+ onDragEnd(event);
19728
+ }
19729
  }
19730
+ }, (0,external_wp_element_namespaceObject.createElement)(inserter_listbox_item, _extends({
19731
+ isFirst: isFirst,
19732
+ className: classnames_default()('block-editor-block-types-list__item', className),
19733
+ disabled: item.isDisabled,
19734
+ onClick: event => {
19735
+ event.preventDefault();
19736
+ onSelect(item, isAppleOS() ? event.metaKey : event.ctrlKey);
19737
+ onHover(null);
19738
+ },
19739
+ onKeyDown: event => {
19740
+ const {
19741
+ keyCode
19742
+ } = event;
19743
+
19744
+ if (keyCode === external_wp_keycodes_namespaceObject.ENTER) {
19745
+ event.preventDefault();
19746
+ onSelect(item, isAppleOS() ? event.metaKey : event.ctrlKey);
19747
+ onHover(null);
19748
+ }
19749
+ },
19750
+ onFocus: () => {
19751
+ if (isDragging.current) {
19752
+ return;
19753
+ }
19754
+
19755
+ onHover(item);
19756
+ },
19757
+ onMouseEnter: () => {
19758
+ if (isDragging.current) {
19759
+ return;
19760
+ }
19761
+
19762
+ onHover(item);
19763
+ },
19764
+ onMouseLeave: () => onHover(null),
19765
+ onBlur: () => onHover(null)
19766
+ }, props), (0,external_wp_element_namespaceObject.createElement)("span", {
19767
+ className: "block-editor-block-types-list__item-icon",
19768
+ style: itemIconStyle
19769
+ }, (0,external_wp_element_namespaceObject.createElement)(BlockIcon, {
19770
+ icon: item.icon,
19771
+ showColors: true
19772
+ })), (0,external_wp_element_namespaceObject.createElement)("span", {
19773
+ className: "block-editor-block-types-list__item-title"
19774
+ }, item.title))));
19775
+ }
19776
+
19777
+ /* harmony default export */ var inserter_list_item = ((0,external_wp_element_namespaceObject.memo)(InserterListItem));
19778
+ //# sourceMappingURL=index.js.map
19779
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter-listbox/group.js
19780
+
19781
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19782
 
19783
  /**
19784
  * WordPress dependencies
19787
 
19788
 
19789
 
19790
+ function InserterListboxGroup(props, ref) {
19791
+ const [shouldSpeak, setShouldSpeak] = (0,external_wp_element_namespaceObject.useState)(false);
19792
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
19793
+ if (shouldSpeak) {
19794
+ (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Use left and right arrow keys to move through blocks'));
19795
+ }
19796
+ }, [shouldSpeak]);
19797
+ return (0,external_wp_element_namespaceObject.createElement)("div", _extends({
19798
+ ref: ref,
19799
+ role: "listbox",
19800
+ "aria-orientation": "horizontal",
19801
+ onFocus: () => {
19802
+ setShouldSpeak(true);
19803
+ },
19804
+ onBlur: event => {
19805
+ const focusingOutsideGroup = !event.currentTarget.contains(event.relatedTarget);
19806
+
19807
+ if (focusingOutsideGroup) {
19808
+ setShouldSpeak(false);
19809
+ }
19810
+ }
19811
+ }, props));
19812
+ }
19813
+
19814
+ /* harmony default export */ var group = ((0,external_wp_element_namespaceObject.forwardRef)(InserterListboxGroup));
19815
+ //# sourceMappingURL=group.js.map
19816
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter-listbox/row.js
19817
 
19818
 
 
 
 
 
 
 
 
 
 
19819
 
19820
  /**
19821
+ * WordPress dependencies
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19822
  */
19823
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19824
 
19825
+ /**
19826
+ * Internal dependencies
19827
+ */
 
 
 
19828
 
19829
 
 
19830
 
19831
+ function InserterListboxRow(props, ref) {
19832
+ const state = (0,external_wp_element_namespaceObject.useContext)(context);
19833
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableCompositeGroup, _extends({
19834
+ state: state,
19835
+ role: "presentation",
19836
+ ref: ref
19837
+ }, props));
19838
+ }
19839
 
19840
+ /* harmony default export */ var inserter_listbox_row = ((0,external_wp_element_namespaceObject.forwardRef)(InserterListboxRow));
19841
+ //# sourceMappingURL=row.js.map
19842
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-types-list/index.js
19843
 
 
19844
 
19845
+ /**
19846
+ * WordPress dependencies
19847
+ */
19848
 
19849
+ /**
19850
+ * Internal dependencies
19851
+ */
 
 
19852
 
 
 
 
 
 
 
19853
 
19854
 
 
 
 
 
 
 
19855
 
19856
+ function chunk(array, size) {
19857
+ const chunks = [];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19858
 
19859
+ for (let i = 0, j = array.length; i < j; i += size) {
19860
+ chunks.push(array.slice(i, i + size));
19861
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19862
 
19863
+ return chunks;
19864
+ }
 
 
 
 
 
19865
 
19866
+ function BlockTypesList({
19867
+ items = [],
19868
+ onSelect,
19869
+ onHover = () => {},
19870
+ children,
19871
+ label,
19872
+ isDraggable = true
19873
+ }) {
19874
+ return (0,external_wp_element_namespaceObject.createElement)(group, {
19875
+ className: "block-editor-block-types-list",
19876
+ "aria-label": label
19877
+ }, chunk(items, 3).map((row, i) => (0,external_wp_element_namespaceObject.createElement)(inserter_listbox_row, {
19878
+ key: i
19879
+ }, row.map((item, j) => (0,external_wp_element_namespaceObject.createElement)(inserter_list_item, {
19880
+ key: item.id,
19881
+ item: item,
19882
+ className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(item.id),
19883
+ onSelect: onSelect,
19884
+ onHover: onHover,
19885
+ isDraggable: isDraggable,
19886
+ isFirst: i === 0 && j === 0
19887
+ })))), children);
19888
+ }
19889
 
19890
+ /* harmony default export */ var block_types_list = (BlockTypesList);
19891
+ //# sourceMappingURL=index.js.map
19892
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/panel.js
19893
 
 
 
 
 
 
19894
 
19895
+ /**
19896
+ * WordPress dependencies
19897
+ */
19898
 
 
 
 
 
 
 
 
 
 
19899
 
19900
+ function InserterPanel({
19901
+ title,
19902
+ icon,
19903
+ children
19904
+ }) {
19905
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
19906
+ className: "block-editor-inserter__panel-header"
19907
+ }, (0,external_wp_element_namespaceObject.createElement)("h2", {
19908
+ className: "block-editor-inserter__panel-title"
19909
+ }, title), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
19910
+ icon: icon
19911
+ })), (0,external_wp_element_namespaceObject.createElement)("div", {
19912
+ className: "block-editor-inserter__panel-content"
19913
+ }, children));
19914
  }
 
 
 
19915
 
19916
+ /* harmony default export */ var panel = (InserterPanel);
19917
+ //# sourceMappingURL=panel.js.map
19918
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/hooks/use-block-types-state.js
19919
  /**
19920
  * WordPress dependencies
19921
  */
19922
 
19923
 
19924
+
19925
  /**
19926
  * Internal dependencies
19927
  */
19928
 
19929
 
19930
+ /**
19931
+ * Retrieves the block types inserter state.
19932
+ *
19933
+ * @param {string=} rootClientId Insertion's root client ID.
19934
+ * @param {Function} onInsert function called when inserter a list of blocks.
19935
+ * @return {Array} Returns the block types state. (block types, categories, collections, onSelect handler)
19936
+ */
19937
 
19938
+ const useBlockTypesState = (rootClientId, onInsert) => {
 
 
 
 
 
 
 
 
19939
  const {
19940
+ categories,
19941
+ collections,
19942
+ items
19943
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
19944
+ const {
19945
+ getInserterItems
19946
+ } = select(store);
19947
+ const {
19948
+ getCategories,
19949
+ getCollections
19950
+ } = select(external_wp_blocks_namespaceObject.store);
19951
+ return {
19952
+ categories: getCategories(),
19953
+ collections: getCollections(),
19954
+ items: getInserterItems(rootClientId)
19955
+ };
19956
+ }, [rootClientId]);
19957
+ const onSelectItem = (0,external_wp_element_namespaceObject.useCallback)(({
19958
+ name,
19959
+ initialAttributes,
19960
+ innerBlocks
19961
+ }, shouldFocusBlock) => {
19962
+ const insertedBlock = (0,external_wp_blocks_namespaceObject.createBlock)(name, initialAttributes, (0,external_wp_blocks_namespaceObject.createBlocksFromInnerBlocksTemplate)(innerBlocks));
19963
+ onInsert(insertedBlock, undefined, shouldFocusBlock);
19964
+ }, [onInsert]);
19965
+ return [items, categories, collections, onSelectItem];
19966
+ };
19967
 
19968
+ /* harmony default export */ var use_block_types_state = (useBlockTypesState);
19969
+ //# sourceMappingURL=use-block-types-state.js.map
19970
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter-listbox/index.js
19971
 
19972
 
19973
  /**
19979
  */
19980
 
19981
 
19982
+
19983
+
19984
+
19985
+
19986
+ function InserterListbox({
19987
+ children
19988
  }) {
19989
+ const compositeState = (0,external_wp_components_namespaceObject.__unstableUseCompositeState)({
19990
+ shift: true,
19991
+ wrap: 'horizontal'
19992
+ });
19993
+ return (0,external_wp_element_namespaceObject.createElement)(context.Provider, {
19994
+ value: compositeState
19995
+ }, children);
19996
  }
19997
+
19998
+ /* harmony default export */ var inserter_listbox = (InserterListbox);
19999
+ //# sourceMappingURL=index.js.map
20000
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/block-types-tab.js
20001
 
20002
 
20003
+ /**
20004
+ * External dependencies
20005
+ */
20006
 
20007
  /**
20008
  * WordPress dependencies
20009
  */
20010
 
20011
 
20012
+
20013
+
20014
  /**
20015
  * Internal dependencies
20016
  */
20017
 
20018
 
20019
+
20020
+
20021
+
20022
+
20023
+ const getBlockNamespace = item => item.name.split('/')[0];
20024
+
20025
+ const MAX_SUGGESTED_ITEMS = 6;
20026
  /**
20027
+ * Shared reference to an empty array for cases where it is important to avoid
20028
+ * returning a new array reference on every invocation and rerendering the component.
 
20029
  *
20030
+ * @type {Array}
20031
  */
20032
 
20033
+ const block_types_tab_EMPTY_ARRAY = [];
20034
+ function BlockTypesTab({
20035
+ rootClientId,
20036
+ onInsert,
20037
+ onHover,
20038
+ showMostUsedBlocks
20039
+ }) {
20040
+ const [items, categories, collections, onSelectItem] = use_block_types_state(rootClientId, onInsert);
20041
+ const suggestedItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
20042
+ return (0,external_lodash_namespaceObject.orderBy)(items, ['frecency'], ['desc']).slice(0, MAX_SUGGESTED_ITEMS);
20043
+ }, [items]);
20044
+ const uncategorizedItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
20045
+ return items.filter(item => !item.category);
20046
+ }, [items]);
20047
+ const itemsPerCategory = (0,external_wp_element_namespaceObject.useMemo)(() => {
20048
+ return (0,external_lodash_namespaceObject.flow)(itemList => itemList.filter(item => item.category && item.category !== 'reusable'), itemList => (0,external_lodash_namespaceObject.groupBy)(itemList, 'category'))(items);
20049
+ }, [items]);
20050
+ const itemsPerCollection = (0,external_wp_element_namespaceObject.useMemo)(() => {
20051
+ // Create a new Object to avoid mutating collection.
20052
+ const result = { ...collections
20053
+ };
20054
+ Object.keys(collections).forEach(namespace => {
20055
+ result[namespace] = items.filter(item => getBlockNamespace(item) === namespace);
20056
 
20057
+ if (result[namespace].length === 0) {
20058
+ delete result[namespace];
20059
  }
20060
+ });
20061
+ return result;
20062
+ }, [items, collections]); // Hide block preview on unmount.
20063
 
20064
+ (0,external_wp_element_namespaceObject.useEffect)(() => () => onHover(null), []);
20065
+ /**
20066
+ * The inserter contains a big number of blocks and opening it is a costful operation.
20067
+ * The rendering is the most costful part of it, in order to improve the responsiveness
20068
+ * of the "opening" action, these lazy lists allow us to render the inserter category per category,
20069
+ * once all the categories are rendered, we start rendering the collections and the uncategorized block types.
20070
+ */
20071
+
20072
+ const currentlyRenderedCategories = (0,external_wp_compose_namespaceObject.useAsyncList)(categories);
20073
+ const didRenderAllCategories = categories.length === currentlyRenderedCategories.length; // Async List requires an array
20074
+
20075
+ const collectionEntries = (0,external_wp_element_namespaceObject.useMemo)(() => {
20076
+ return Object.entries(collections);
20077
+ }, [collections]);
20078
+ const currentlyRenderedCollections = (0,external_wp_compose_namespaceObject.useAsyncList)(didRenderAllCategories ? collectionEntries : block_types_tab_EMPTY_ARRAY);
20079
+ return (0,external_wp_element_namespaceObject.createElement)(inserter_listbox, null, (0,external_wp_element_namespaceObject.createElement)("div", null, showMostUsedBlocks && !!suggestedItems.length && (0,external_wp_element_namespaceObject.createElement)(panel, {
20080
+ title: (0,external_wp_i18n_namespaceObject._x)('Most used', 'blocks')
20081
+ }, (0,external_wp_element_namespaceObject.createElement)(block_types_list, {
20082
+ items: suggestedItems,
20083
+ onSelect: onSelectItem,
20084
+ onHover: onHover,
20085
+ label: (0,external_wp_i18n_namespaceObject._x)('Most used', 'blocks')
20086
+ })), (0,external_lodash_namespaceObject.map)(currentlyRenderedCategories, category => {
20087
+ const categoryItems = itemsPerCategory[category.slug];
20088
+
20089
+ if (!categoryItems || !categoryItems.length) {
20090
+ return null;
20091
  }
20092
 
20093
+ return (0,external_wp_element_namespaceObject.createElement)(panel, {
20094
+ key: category.slug,
20095
+ title: category.title,
20096
+ icon: category.icon
20097
+ }, (0,external_wp_element_namespaceObject.createElement)(block_types_list, {
20098
+ items: categoryItems,
20099
+ onSelect: onSelectItem,
20100
+ onHover: onHover,
20101
+ label: category.title
20102
+ }));
20103
+ }), didRenderAllCategories && uncategorizedItems.length > 0 && (0,external_wp_element_namespaceObject.createElement)(panel, {
20104
+ className: "block-editor-inserter__uncategorized-blocks-panel",
20105
+ title: (0,external_wp_i18n_namespaceObject.__)('Uncategorized')
20106
+ }, (0,external_wp_element_namespaceObject.createElement)(block_types_list, {
20107
+ items: uncategorizedItems,
20108
+ onSelect: onSelectItem,
20109
+ onHover: onHover,
20110
+ label: (0,external_wp_i18n_namespaceObject.__)('Uncategorized')
20111
+ })), (0,external_lodash_namespaceObject.map)(currentlyRenderedCollections, ([namespace, collection]) => {
20112
+ const collectionItems = itemsPerCollection[namespace];
20113
+
20114
+ if (!collectionItems || !collectionItems.length) {
20115
+ return null;
20116
+ }
20117
+
20118
+ return (0,external_wp_element_namespaceObject.createElement)(panel, {
20119
+ key: namespace,
20120
+ title: collection.title,
20121
+ icon: collection.icon
20122
+ }, (0,external_wp_element_namespaceObject.createElement)(block_types_list, {
20123
+ items: collectionItems,
20124
+ onSelect: onSelectItem,
20125
+ onHover: onHover,
20126
+ label: collection.title
20127
+ }));
20128
+ })));
20129
  }
20130
+ /* harmony default export */ var block_types_tab = (BlockTypesTab);
20131
+ //# sourceMappingURL=block-types-tab.js.map
20132
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/pattern-panel.js
20133
+
20134
+
20135
  /**
20136
  * External dependencies
20137
  */
20142
 
20143
 
20144
 
 
 
 
20145
 
20146
+ function PatternInserterPanel({
20147
+ selectedCategory,
20148
+ patternCategories,
20149
+ onClickCategory,
20150
+ children
20151
+ }) {
20152
+ const categoryOptions = () => {
20153
+ const options = [];
20154
+ patternCategories.map(patternCategory => {
20155
+ return options.push({
20156
+ value: patternCategory.name,
20157
+ label: patternCategory.label
20158
+ });
20159
+ });
20160
+ return options;
20161
+ };
20162
+
20163
+ const onChangeSelect = selected => {
20164
+ onClickCategory(patternCategories.find(patternCategory => selected === patternCategory.name));
20165
+ };
20166
 
20167
+ const getPanelHeaderClassName = () => {
20168
+ return classnames_default()('block-editor-inserter__panel-header', 'block-editor-inserter__panel-header-patterns');
20169
+ }; // In iOS-based mobile devices, the onBlur will fire when selecting an option
20170
+ // from a Select element. To prevent closing the useDialog on iOS devices, we
20171
+ // stop propagating the onBlur event if there is no relatedTarget, which means
20172
+ // that the user most likely did not click on an element within the editor canvas.
20173
 
20174
 
20175
+ const onBlur = event => {
20176
+ if (!(event !== null && event !== void 0 && event.relatedTarget)) {
20177
+ event.stopPropagation();
 
 
 
20178
  }
20179
+ };
20180
+
20181
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
20182
+ className: getPanelHeaderClassName()
20183
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
20184
+ className: "block-editor-inserter__panel-dropdown",
20185
+ label: (0,external_wp_i18n_namespaceObject.__)('Filter patterns'),
20186
+ hideLabelFromVision: true,
20187
+ value: selectedCategory.name,
20188
+ onChange: onChangeSelect,
20189
+ onBlur: onBlur,
20190
+ options: categoryOptions()
20191
+ })), (0,external_wp_element_namespaceObject.createElement)("div", {
20192
+ className: "block-editor-inserter__panel-content"
20193
+ }, children));
20194
  }
20195
+
20196
+ /* harmony default export */ var pattern_panel = (PatternInserterPanel);
20197
+ //# sourceMappingURL=pattern-panel.js.map
20198
+ ;// CONCATENATED MODULE: external ["wp","notices"]
20199
+ var external_wp_notices_namespaceObject = window["wp"]["notices"];
20200
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/hooks/use-patterns-state.js
20201
  /**
20202
+ * External dependencies
 
 
 
 
20203
  */
20204
 
20205
+ /**
20206
+ * WordPress dependencies
20207
+ */
20208
 
 
 
 
20209
 
 
 
20210
 
 
 
 
 
20211
 
 
 
20212
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20213
 
20214
+ /**
20215
+ * Internal dependencies
20216
+ */
 
 
 
 
 
20217
 
 
 
 
 
 
 
20218
 
20219
+ /**
20220
+ * Retrieves the block patterns inserter state.
20221
+ *
20222
+ * @param {Function} onInsert function called when inserter a list of blocks.
20223
+ * @param {string=} rootClientId Insertion's root client ID.
20224
+ *
20225
+ * @return {Array} Returns the patterns state. (patterns, categories, onSelect handler)
20226
+ */
20227
+
20228
+ const usePatternsState = (onInsert, rootClientId) => {
20229
+ const {
20230
+ patternCategories,
20231
+ patterns
20232
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
20233
  const {
20234
+ __experimentalGetAllowedPatterns,
20235
+ getSettings
20236
+ } = select(store);
20237
+ return {
20238
+ patterns: __experimentalGetAllowedPatterns(rootClientId),
20239
+ patternCategories: getSettings().__experimentalBlockPatternCategories
20240
+ };
20241
+ }, [rootClientId]);
20242
+ const {
20243
+ createSuccessNotice
20244
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
20245
+ const onClickPattern = (0,external_wp_element_namespaceObject.useCallback)((pattern, blocks) => {
20246
+ onInsert((0,external_lodash_namespaceObject.map)(blocks, block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block)), pattern.name);
20247
+ createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(
20248
+ /* translators: %s: block pattern title. */
20249
+ (0,external_wp_i18n_namespaceObject.__)('Block pattern "%s" inserted.'), pattern.title), {
20250
+ type: 'snackbar'
20251
+ });
20252
+ }, []);
20253
+ return [patterns, patternCategories, onClickPattern];
20254
+ };
20255
 
20256
+ /* harmony default export */ var use_patterns_state = (usePatternsState);
20257
+ //# sourceMappingURL=use-patterns-state.js.map
20258
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-patterns-list/index.js
 
20259
 
 
20260
 
 
 
 
 
 
 
20261
 
20262
+ /**
20263
+ * WordPress dependencies
20264
+ */
 
20265
 
 
 
20266
 
 
 
 
20267
 
20268
+
20269
+ /**
20270
+ * Internal dependencies
20271
+ */
20272
 
20273
 
 
 
 
 
20274
 
20275
 
 
 
 
 
 
20276
 
20277
+ function BlockPattern({
20278
+ isDraggable,
20279
+ pattern,
20280
+ onClick,
20281
+ composite
20282
+ }) {
20283
+ const {
20284
+ name,
20285
+ viewportWidth
20286
+ } = pattern;
20287
+ const {
20288
+ blocks
20289
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).__experimentalGetParsedPattern(name), [name]);
20290
+ const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockPattern);
20291
+ const descriptionId = `block-editor-block-patterns-list__item-description-${instanceId}`;
20292
+ return (0,external_wp_element_namespaceObject.createElement)(inserter_draggable_blocks, {
20293
+ isEnabled: isDraggable,
20294
+ blocks: blocks
20295
+ }, ({
20296
+ draggable,
20297
+ onDragStart,
20298
+ onDragEnd
20299
+ }) => (0,external_wp_element_namespaceObject.createElement)("div", {
20300
+ className: "block-editor-block-patterns-list__list-item",
20301
+ "aria-label": pattern.title,
20302
+ "aria-describedby": pattern.description ? descriptionId : undefined,
20303
+ draggable: draggable,
20304
+ onDragStart: onDragStart,
20305
+ onDragEnd: onDragEnd
20306
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableCompositeItem, _extends({
20307
+ role: "option",
20308
+ as: "div"
20309
+ }, composite, {
20310
+ className: "block-editor-block-patterns-list__item",
20311
+ onClick: () => onClick(pattern, blocks)
20312
+ }), (0,external_wp_element_namespaceObject.createElement)(block_preview, {
20313
+ blocks: blocks,
20314
+ viewportWidth: viewportWidth
20315
+ }), (0,external_wp_element_namespaceObject.createElement)("div", {
20316
+ className: "block-editor-block-patterns-list__item-title"
20317
+ }, pattern.title), !!pattern.description && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
20318
+ id: descriptionId
20319
+ }, pattern.description))));
20320
+ }
20321
+
20322
+ function BlockPatternPlaceholder() {
20323
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
20324
+ className: "block-editor-block-patterns-list__item is-placeholder"
20325
+ });
20326
+ }
20327
+
20328
+ function BlockPatternList({
20329
+ isDraggable,
20330
+ blockPatterns,
20331
+ shownPatterns,
20332
+ onClickPattern,
20333
+ orientation,
20334
+ label = (0,external_wp_i18n_namespaceObject.__)('Block Patterns')
20335
+ }) {
20336
+ const composite = (0,external_wp_components_namespaceObject.__unstableUseCompositeState)({
20337
+ orientation
20338
+ });
20339
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableComposite, _extends({}, composite, {
20340
+ role: "listbox",
20341
+ className: "block-editor-block-patterns-list",
20342
+ "aria-label": label
20343
+ }), blockPatterns.map(pattern => {
20344
+ const isShown = shownPatterns.includes(pattern);
20345
+ return isShown ? (0,external_wp_element_namespaceObject.createElement)(BlockPattern, {
20346
+ key: pattern.name,
20347
+ pattern: pattern,
20348
+ onClick: onClickPattern,
20349
+ isDraggable: isDraggable,
20350
+ composite: composite
20351
+ }) : (0,external_wp_element_namespaceObject.createElement)(BlockPatternPlaceholder, {
20352
+ key: pattern.name
20353
+ });
20354
+ }));
20355
+ }
20356
+
20357
+ /* harmony default export */ var block_patterns_list = (BlockPatternList);
20358
+ //# sourceMappingURL=index.js.map
20359
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/block-patterns-tab.js
20360
 
 
 
 
 
 
 
 
 
 
20361
 
20362
+ /**
20363
+ * External dependencies
20364
+ */
20365
 
20366
  /**
20367
  * WordPress dependencies
20370
 
20371
 
20372
 
 
20373
  /**
20374
  * Internal dependencies
20375
  */
20376
 
20377
 
20378
 
 
 
 
 
 
 
20379
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20380
 
20381
+ function BlockPatternsCategory({
20382
+ rootClientId,
20383
+ onInsert,
20384
+ selectedCategory,
20385
+ onClickCategory
20386
+ }) {
20387
+ const [allPatterns, allCategories, onClick] = use_patterns_state(onInsert, rootClientId); // Remove any empty categories
20388
 
20389
+ const populatedCategories = (0,external_wp_element_namespaceObject.useMemo)(() => allCategories.filter(category => allPatterns.some(pattern => {
20390
+ var _pattern$categories;
20391
 
20392
+ return (_pattern$categories = pattern.categories) === null || _pattern$categories === void 0 ? void 0 : _pattern$categories.includes(category.name);
20393
+ })).sort(({
20394
+ name: currentName
20395
+ }, {
20396
+ name: nextName
20397
+ }) => {
20398
+ if (![currentName, nextName].includes('featured')) {
20399
+ return 0;
 
 
 
 
 
 
20400
  }
 
20401
 
20402
+ return currentName === 'featured' ? -1 : 1;
20403
+ }), [allPatterns, allCategories]);
20404
+ const patternCategory = selectedCategory ? selectedCategory : populatedCategories[0];
20405
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
20406
+ if (allPatterns.some(pattern => getPatternIndex(pattern) === Infinity) && !populatedCategories.find(category => category.name === 'uncategorized')) {
20407
+ populatedCategories.push({
20408
+ name: 'uncategorized',
20409
+ label: (0,external_wp_i18n_namespaceObject._x)('Uncategorized')
20410
+ });
20411
+ }
20412
+ }, [populatedCategories, allPatterns]);
20413
+ const getPatternIndex = (0,external_wp_element_namespaceObject.useCallback)(pattern => {
20414
+ if (!pattern.categories || !pattern.categories.length) {
20415
+ return Infinity;
20416
+ }
20417
+
20418
+ const indexedCategories = (0,external_lodash_namespaceObject.fromPairs)(populatedCategories.map(({
20419
+ name
20420
+ }, index) => [name, index]));
20421
+ return Math.min(...pattern.categories.map(cat => indexedCategories[cat] !== undefined ? indexedCategories[cat] : Infinity));
20422
+ }, [populatedCategories]);
20423
+ const currentCategoryPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => allPatterns.filter(pattern => patternCategory.name === 'uncategorized' ? getPatternIndex(pattern) === Infinity : pattern.categories && pattern.categories.includes(patternCategory.name)), [allPatterns, patternCategory]); // Ordering the patterns is important for the async rendering.
20424
+
20425
+ const orderedPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => {
20426
+ return currentCategoryPatterns.sort((a, b) => {
20427
+ return getPatternIndex(a) - getPatternIndex(b);
20428
+ });
20429
+ }, [currentCategoryPatterns, getPatternIndex]);
20430
+ const currentShownPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(orderedPatterns);
20431
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, !!currentCategoryPatterns.length && (0,external_wp_element_namespaceObject.createElement)(pattern_panel, {
20432
+ selectedCategory: patternCategory,
20433
+ patternCategories: populatedCategories,
20434
+ onClickCategory: onClickCategory
20435
+ }, (0,external_wp_element_namespaceObject.createElement)(block_patterns_list, {
20436
+ shownPatterns: currentShownPatterns,
20437
+ blockPatterns: currentCategoryPatterns,
20438
+ onClickPattern: onClick,
20439
+ label: patternCategory.label,
20440
+ orientation: "vertical",
20441
+ isDraggable: true
20442
+ })));
20443
+ }
20444
+
20445
+ function BlockPatternsTabs({
20446
+ rootClientId,
20447
+ onInsert,
20448
+ onClickCategory,
20449
+ selectedCategory
20450
+ }) {
20451
+ return (0,external_wp_element_namespaceObject.createElement)(BlockPatternsCategory, {
20452
+ rootClientId: rootClientId,
20453
+ selectedCategory: selectedCategory,
20454
+ onInsert: onInsert,
20455
+ onClickCategory: onClickCategory
20456
  });
20457
+ }
 
 
 
 
20458
 
20459
+ /* harmony default export */ var block_patterns_tab = (BlockPatternsTabs);
20460
+ //# sourceMappingURL=block-patterns-tab.js.map
20461
+ ;// CONCATENATED MODULE: external ["wp","url"]
20462
+ var external_wp_url_namespaceObject = window["wp"]["url"];
20463
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/no-results.js
 
 
 
 
 
20464
 
20465
 
20466
+ /**
20467
+ * WordPress dependencies
20468
+ */
20469
 
 
 
20470
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20471
 
20472
+ function InserterNoResults() {
20473
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
20474
+ className: "block-editor-inserter__no-results"
20475
+ }, (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
20476
+ className: "block-editor-inserter__no-results-icon",
20477
+ icon: block_default
20478
+ }), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('No results found.')));
20479
+ }
20480
 
20481
+ /* harmony default export */ var no_results = (InserterNoResults);
20482
+ //# sourceMappingURL=no-results.js.map
20483
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/reusable-blocks-tab.js
20484
 
 
 
 
20485
 
20486
+ /**
20487
+ * WordPress dependencies
20488
+ */
20489
 
 
 
 
 
20490
 
 
 
 
 
 
 
20491
 
20492
+ /**
20493
+ * Internal dependencies
20494
+ */
 
 
 
 
 
 
 
 
20495
 
20496
 
 
 
20497
 
 
 
 
20498
 
 
 
 
20499
 
 
 
 
20500
 
20501
+ function ReusableBlocksList({
20502
+ onHover,
20503
+ onInsert,
20504
+ rootClientId
20505
+ }) {
20506
+ const [items,,, onSelectItem] = use_block_types_state(rootClientId, onInsert);
20507
+ const filteredItems = (0,external_wp_element_namespaceObject.useMemo)(() => {
20508
+ return items.filter(({
20509
+ category
20510
+ }) => category === 'reusable');
20511
+ }, [items]);
20512
 
20513
+ if (filteredItems.length === 0) {
20514
+ return (0,external_wp_element_namespaceObject.createElement)(no_results, null);
20515
+ }
 
 
 
 
20516
 
20517
+ return (0,external_wp_element_namespaceObject.createElement)(panel, {
20518
+ title: (0,external_wp_i18n_namespaceObject.__)('Reusable blocks')
20519
+ }, (0,external_wp_element_namespaceObject.createElement)(block_types_list, {
20520
+ items: filteredItems,
20521
+ onSelect: onSelectItem,
20522
+ onHover: onHover,
20523
+ label: (0,external_wp_i18n_namespaceObject.__)('Reusable blocks')
20524
+ }));
20525
+ } // The unwrapped component is only exported for use by unit tests.
20526
+
20527
+ /**
20528
+ * List of reusable blocks shown in the "Reusable" tab of the inserter.
20529
+ *
20530
+ * @param {Object} props Component props.
20531
+ * @param {?string} props.rootClientId Client id of block to insert into.
20532
+ * @param {Function} props.onInsert Callback to run when item is inserted.
20533
+ * @param {Function} props.onHover Callback to run when item is hovered.
20534
+ *
20535
+ * @return {WPComponent} The component.
20536
+ */
20537
+
20538
+
20539
+ function ReusableBlocksTab({
20540
+ rootClientId,
20541
+ onInsert,
20542
+ onHover
20543
+ }) {
20544
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(ReusableBlocksList, {
20545
+ onHover: onHover,
20546
+ onInsert: onInsert,
20547
+ rootClientId: rootClientId
20548
+ }), (0,external_wp_element_namespaceObject.createElement)("div", {
20549
+ className: "block-editor-inserter__manage-reusable-blocks-container"
20550
+ }, (0,external_wp_element_namespaceObject.createElement)("a", {
20551
+ className: "block-editor-inserter__manage-reusable-blocks",
20552
+ href: (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
20553
+ post_type: 'wp_block'
20554
+ })
20555
+ }, (0,external_wp_i18n_namespaceObject.__)('Manage Reusable blocks'))));
20556
  }
20557
+ /* harmony default export */ var reusable_blocks_tab = (ReusableBlocksTab);
20558
+ //# sourceMappingURL=reusable-blocks-tab.js.map
20559
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter-menu-extension/index.js
20560
+ /**
20561
+ * WordPress dependencies
20562
+ */
20563
+
20564
+ const {
20565
+ Fill: __unstableInserterMenuExtension,
20566
+ Slot
20567
+ } = (0,external_wp_components_namespaceObject.createSlotFill)('__unstableInserterMenuExtension');
20568
+ __unstableInserterMenuExtension.Slot = Slot;
20569
+ /* harmony default export */ var inserter_menu_extension = (__unstableInserterMenuExtension);
20570
+ //# sourceMappingURL=index.js.map
20571
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/hooks/use-insertion-point.js
20572
  /**
20573
  * External dependencies
20574
  */
20581
 
20582
 
20583
 
20584
+
20585
  /**
20586
  * Internal dependencies
20587
  */
20588
 
20589
 
 
20590
  /**
20591
+ * @typedef WPInserterConfig
 
 
 
 
 
20592
  *
20593
+ * @property {string=} rootClientId If set, insertion will be into the
20594
+ * block with this ID.
20595
+ * @property {number=} insertionIndex If set, insertion will be into this
20596
+ * explicit position.
20597
+ * @property {string=} clientId If set, insertion will be after the
20598
+ * block with this ID.
20599
+ * @property {boolean=} isAppender Whether the inserter is an appender
20600
+ * or not.
20601
+ * @property {Function=} onSelect Called after insertion.
20602
  */
20603
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20604
  /**
20605
+ * Returns the insertion point state given the inserter config.
 
 
 
 
 
 
 
 
 
20606
  *
20607
+ * @param {WPInserterConfig} config Inserter Config.
20608
+ * @return {Array} Insertion Point State (rootClientID, onInsertBlocks and onToggle).
20609
  */
20610
 
20611
+ function useInsertionPoint({
20612
+ rootClientId = '',
20613
+ insertionIndex,
20614
+ clientId,
20615
+ isAppender,
20616
+ onSelect,
20617
+ shouldFocusBlock = true
20618
+ }) {
20619
+ const {
20620
+ getSelectedBlock
20621
+ } = (0,external_wp_data_namespaceObject.useSelect)(store);
20622
+ const {
20623
+ destinationRootClientId,
20624
+ destinationIndex
20625
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
20626
+ const {
20627
+ getSelectedBlockClientId,
20628
+ getBlockRootClientId,
20629
+ getBlockIndex,
20630
+ getBlockOrder
20631
+ } = select(store);
20632
+ const selectedBlockClientId = getSelectedBlockClientId();
20633
+ let _destinationRootClientId = rootClientId;
20634
 
20635
+ let _destinationIndex;
 
 
 
 
20636
 
20637
+ if (insertionIndex !== undefined) {
20638
+ // Insert into a specific index.
20639
+ _destinationIndex = insertionIndex;
20640
+ } else if (clientId) {
20641
+ // Insert after a specific client ID.
20642
+ _destinationIndex = getBlockIndex(clientId, _destinationRootClientId);
20643
+ } else if (!isAppender && selectedBlockClientId) {
20644
+ _destinationRootClientId = getBlockRootClientId(selectedBlockClientId);
20645
+ _destinationIndex = getBlockIndex(selectedBlockClientId, _destinationRootClientId) + 1;
20646
+ } else {
20647
+ // Insert at the end of the list.
20648
+ _destinationIndex = getBlockOrder(_destinationRootClientId).length;
20649
+ }
20650
 
20651
+ return {
20652
+ destinationRootClientId: _destinationRootClientId,
20653
+ destinationIndex: _destinationIndex
20654
+ };
20655
+ }, [rootClientId, insertionIndex, clientId, isAppender]);
20656
+ const {
20657
+ replaceBlocks,
20658
+ insertBlocks,
20659
+ showInsertionPoint,
20660
+ hideInsertionPoint
20661
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
20662
+ const onInsertBlocks = (0,external_wp_element_namespaceObject.useCallback)((blocks, meta, shouldForceFocusBlock = false) => {
20663
+ const selectedBlock = getSelectedBlock();
20664
 
20665
+ if (!isAppender && selectedBlock && (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(selectedBlock)) {
20666
+ replaceBlocks(selectedBlock.clientId, blocks, null, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta);
20667
+ } else {
20668
+ insertBlocks(blocks, destinationIndex, destinationRootClientId, true, shouldFocusBlock || shouldForceFocusBlock ? 0 : null, meta);
20669
+ }
20670
 
20671
+ const message = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %d: the name of the block that has been added
20672
+ (0,external_wp_i18n_namespaceObject._n)('%d block added.', '%d blocks added.', (0,external_lodash_namespaceObject.castArray)(blocks).length), (0,external_lodash_namespaceObject.castArray)(blocks).length);
20673
+ (0,external_wp_a11y_namespaceObject.speak)(message);
20674
+
20675
+ if (onSelect) {
20676
+ onSelect();
20677
+ }
20678
+ }, [isAppender, getSelectedBlock, replaceBlocks, insertBlocks, destinationRootClientId, destinationIndex, onSelect, shouldFocusBlock]);
20679
+ const onToggleInsertionPoint = (0,external_wp_element_namespaceObject.useCallback)(show => {
20680
+ if (show) {
20681
+ showInsertionPoint(destinationRootClientId, destinationIndex);
20682
+ } else {
20683
+ hideInsertionPoint();
20684
+ }
20685
+ }, [showInsertionPoint, hideInsertionPoint, destinationRootClientId, destinationIndex]);
20686
+ return [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint];
20687
+ }
20688
+
20689
+ /* harmony default export */ var use_insertion_point = (useInsertionPoint);
20690
+ //# sourceMappingURL=use-insertion-point.js.map
20691
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/search-items.js
20692
+ /**
20693
+ * External dependencies
20694
+ */
20695
+ // Default search helpers
20696
 
20697
+ const defaultGetName = item => item.name || '';
20698
 
20699
+ const defaultGetTitle = item => item.title;
 
 
20700
 
20701
+ const defaultGetDescription = item => item.description || '';
 
20702
 
20703
+ const defaultGetKeywords = item => item.keywords || [];
 
 
 
20704
 
20705
+ const defaultGetCategory = item => item.category;
 
20706
 
20707
+ const defaultGetCollection = () => null;
20708
+ /**
20709
+ * Sanitizes the search input string.
20710
+ *
20711
+ * @param {string} input The search input to normalize.
20712
+ *
20713
+ * @return {string} The normalized search input.
20714
+ */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20715
 
 
 
 
20716
 
20717
+ function normalizeSearchInput(input = '') {
20718
+ // Disregard diacritics.
20719
+ // Input: "média"
20720
+ input = (0,external_lodash_namespaceObject.deburr)(input); // Accommodate leading slash, matching autocomplete expectations.
20721
+ // Input: "/media"
 
 
20722
 
20723
+ input = input.replace(/^\//, ''); // Lowercase.
20724
+ // Input: "MEDIA"
 
 
 
 
 
 
20725
 
20726
+ input = input.toLowerCase();
20727
+ return input;
20728
+ }
20729
+ /**
20730
+ * Converts the search term into a list of normalized terms.
20731
+ *
20732
+ * @param {string} input The search term to normalize.
20733
+ *
20734
+ * @return {string[]} The normalized list of search terms.
20735
+ */
20736
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20737
 
20738
+ const getNormalizedSearchTerms = (input = '') => {
20739
+ // Extract words.
20740
+ return (0,external_lodash_namespaceObject.words)(normalizeSearchInput(input));
20741
+ };
20742
 
20743
+ const removeMatchingTerms = (unmatchedTerms, unprocessedTerms) => {
20744
+ return (0,external_lodash_namespaceObject.differenceWith)(unmatchedTerms, getNormalizedSearchTerms(unprocessedTerms), (unmatchedTerm, unprocessedTerm) => unprocessedTerm.includes(unmatchedTerm));
20745
+ };
 
20746
 
20747
+ const searchBlockItems = (items, categories, collections, searchInput) => {
20748
+ const normalizedSearchTerms = getNormalizedSearchTerms(searchInput);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20749
 
20750
+ if (normalizedSearchTerms.length === 0) {
20751
+ return items;
20752
+ }
 
 
 
20753
 
20754
+ const config = {
20755
+ getCategory: item => {
20756
+ var _find;
 
 
 
 
 
20757
 
20758
+ return (_find = (0,external_lodash_namespaceObject.find)(categories, {
20759
+ slug: item.category
20760
+ })) === null || _find === void 0 ? void 0 : _find.title;
20761
+ },
20762
+ getCollection: item => {
20763
+ var _collections$item$nam;
20764
 
20765
+ return (_collections$item$nam = collections[item.name.split('/')[0]]) === null || _collections$item$nam === void 0 ? void 0 : _collections$item$nam.title;
20766
+ }
20767
+ };
20768
+ return searchItems(items, searchInput, config);
20769
+ };
20770
+ /**
20771
+ * Filters an item list given a search term.
20772
+ *
20773
+ * @param {Array} items Item list
20774
+ * @param {string} searchInput Search input.
20775
+ * @param {Object} config Search Config.
20776
+ *
20777
+ * @return {Array} Filtered item list.
20778
+ */
20779
 
20780
+ const searchItems = (items = [], searchInput = '', config = {}) => {
20781
+ const normalizedSearchTerms = getNormalizedSearchTerms(searchInput);
20782
 
20783
+ if (normalizedSearchTerms.length === 0) {
20784
+ return items;
20785
+ }
20786
 
20787
+ const rankedItems = items.map(item => {
20788
+ return [item, getItemSearchRank(item, searchInput, config)];
20789
+ }).filter(([, rank]) => rank > 0);
20790
+ rankedItems.sort(([, rank1], [, rank2]) => rank2 - rank1);
20791
+ return rankedItems.map(([item]) => item);
20792
+ };
20793
+ /**
20794
+ * Get the search rank for a given item and a specific search term.
20795
+ * The better the match, the higher the rank.
20796
+ * If the rank equals 0, it should be excluded from the results.
20797
+ *
20798
+ * @param {Object} item Item to filter.
20799
+ * @param {string} searchTerm Search term.
20800
+ * @param {Object} config Search Config.
20801
+ *
20802
+ * @return {number} Search Rank.
20803
+ */
20804
 
20805
+ function getItemSearchRank(item, searchTerm, config = {}) {
20806
+ const {
20807
+ getName = defaultGetName,
20808
+ getTitle = defaultGetTitle,
20809
+ getDescription = defaultGetDescription,
20810
+ getKeywords = defaultGetKeywords,
20811
+ getCategory = defaultGetCategory,
20812
+ getCollection = defaultGetCollection
20813
+ } = config;
20814
+ const name = getName(item);
20815
+ const title = getTitle(item);
20816
+ const description = getDescription(item);
20817
+ const keywords = getKeywords(item);
20818
+ const category = getCategory(item);
20819
+ const collection = getCollection(item);
20820
+ const normalizedSearchInput = normalizeSearchInput(searchTerm);
20821
+ const normalizedTitle = normalizeSearchInput(title);
20822
+ let rank = 0; // Prefers exact matches
20823
+ // Then prefers if the beginning of the title matches the search term
20824
+ // name, keywords, categories, collection, variations match come later.
20825
 
20826
+ if (normalizedSearchInput === normalizedTitle) {
20827
+ rank += 30;
20828
+ } else if (normalizedTitle.startsWith(normalizedSearchInput)) {
20829
+ rank += 20;
20830
+ } else {
20831
+ const terms = [name, title, description, ...keywords, category, collection].join(' ');
20832
+ const normalizedSearchTerms = (0,external_lodash_namespaceObject.words)(normalizedSearchInput);
20833
+ const unmatchedTerms = removeMatchingTerms(normalizedSearchTerms, terms);
20834
 
20835
+ if (unmatchedTerms.length === 0) {
20836
+ rank += 10;
20837
+ }
20838
+ } // Give a better rank to "core" namespaced items.
20839
 
 
 
 
 
 
20840
 
20841
+ if (rank !== 0 && name.startsWith('core/')) {
20842
+ rank++;
20843
+ }
 
20844
 
20845
+ return rank;
20846
+ }
20847
+ //# sourceMappingURL=search-items.js.map
20848
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/search-results.js
 
 
 
 
 
20849
 
 
 
 
 
 
 
 
 
 
 
20850
 
 
 
 
 
 
 
 
 
 
 
 
 
20851
  /**
20852
  * External dependencies
20853
  */
20860
 
20861
 
20862
 
20863
+
20864
  /**
20865
  * Internal dependencies
20866
  */
20867
 
20868
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20869
 
 
 
 
 
 
20870
 
 
 
 
20871
 
 
 
20872
 
 
 
 
20873
 
 
 
 
20874
 
 
 
 
 
 
 
 
 
20875
 
20876
 
20877
 
20878
+ const INITIAL_INSERTER_RESULTS = 9;
20879
  /**
20880
+ * Shared reference to an empty array for cases where it is important to avoid
20881
+ * returning a new array reference on every invocation and rerendering the component.
20882
+ *
20883
+ * @type {Array}
20884
  */
20885
 
20886
+ const search_results_EMPTY_ARRAY = [];
20887
+
20888
+ function InserterSearchResults({
20889
+ filterValue,
20890
+ onSelect,
20891
+ onHover,
20892
+ rootClientId,
20893
+ clientId,
20894
+ isAppender,
20895
+ __experimentalInsertionIndex,
20896
+ maxBlockPatterns,
20897
+ maxBlockTypes,
20898
+ showBlockDirectory = false,
20899
+ isDraggable = true,
20900
+ shouldFocusBlock = true
20901
+ }) {
20902
+ const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
20903
+ const [destinationRootClientId, onInsertBlocks] = use_insertion_point({
20904
+ onSelect,
20905
+ rootClientId,
20906
+ clientId,
20907
+ isAppender,
20908
+ insertionIndex: __experimentalInsertionIndex,
20909
+ shouldFocusBlock
20910
+ });
20911
+ const [blockTypes, blockTypeCategories, blockTypeCollections, onSelectBlockType] = use_block_types_state(destinationRootClientId, onInsertBlocks);
20912
+ const [patterns,, onSelectBlockPattern] = use_patterns_state(onInsertBlocks, destinationRootClientId);
20913
+ const filteredBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => {
20914
+ const results = searchBlockItems((0,external_lodash_namespaceObject.orderBy)(blockTypes, ['frecency'], ['desc']), blockTypeCategories, blockTypeCollections, filterValue);
20915
+ return maxBlockTypes !== undefined ? results.slice(0, maxBlockTypes) : results;
20916
+ }, [filterValue, blockTypes, blockTypeCategories, blockTypeCollections, maxBlockTypes]);
20917
+ const filteredBlockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => {
20918
+ const results = searchItems(patterns, filterValue);
20919
+ return maxBlockPatterns !== undefined ? results.slice(0, maxBlockPatterns) : results;
20920
+ }, [filterValue, patterns, maxBlockPatterns]); // Announce search results on change
20921
+
20922
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
20923
+ if (!filterValue) {
20924
+ return;
20925
+ }
20926
+
20927
+ const count = filteredBlockTypes.length + filteredBlockPatterns.length;
20928
+ const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
20929
+ /* translators: %d: number of results. */
20930
+ (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count);
20931
+ debouncedSpeak(resultsFoundMessage);
20932
+ }, [filterValue, debouncedSpeak]);
20933
+ const currentShownBlockTypes = (0,external_wp_compose_namespaceObject.useAsyncList)(filteredBlockTypes, {
20934
+ step: INITIAL_INSERTER_RESULTS
20935
+ });
20936
+ const currentShownPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(currentShownBlockTypes.length === filteredBlockTypes.length ? filteredBlockPatterns : search_results_EMPTY_ARRAY);
20937
+ const hasItems = !(0,external_lodash_namespaceObject.isEmpty)(filteredBlockTypes) || !(0,external_lodash_namespaceObject.isEmpty)(filteredBlockPatterns);
20938
+ return (0,external_wp_element_namespaceObject.createElement)(inserter_listbox, null, !showBlockDirectory && !hasItems && (0,external_wp_element_namespaceObject.createElement)(no_results, null), !!filteredBlockTypes.length && (0,external_wp_element_namespaceObject.createElement)(panel, {
20939
+ title: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null, (0,external_wp_i18n_namespaceObject.__)('Blocks'))
20940
+ }, (0,external_wp_element_namespaceObject.createElement)(block_types_list, {
20941
+ items: currentShownBlockTypes,
20942
+ onSelect: onSelectBlockType,
20943
+ onHover: onHover,
20944
+ label: (0,external_wp_i18n_namespaceObject.__)('Blocks'),
20945
+ isDraggable: isDraggable
20946
+ })), !!filteredBlockTypes.length && !!filteredBlockPatterns.length && (0,external_wp_element_namespaceObject.createElement)("div", {
20947
+ className: "block-editor-inserter__quick-inserter-separator"
20948
+ }), !!filteredBlockPatterns.length && (0,external_wp_element_namespaceObject.createElement)(panel, {
20949
+ title: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null, (0,external_wp_i18n_namespaceObject.__)('Block Patterns'))
20950
+ }, (0,external_wp_element_namespaceObject.createElement)("div", {
20951
+ className: "block-editor-inserter__quick-inserter-patterns"
20952
+ }, (0,external_wp_element_namespaceObject.createElement)(block_patterns_list, {
20953
+ shownPatterns: currentShownPatterns,
20954
+ blockPatterns: filteredBlockPatterns,
20955
+ onClickPattern: onSelectBlockPattern,
20956
+ isDraggable: isDraggable
20957
+ }))), showBlockDirectory && (0,external_wp_element_namespaceObject.createElement)(inserter_menu_extension.Slot, {
20958
+ fillProps: {
20959
+ onSelect: onSelectBlockType,
20960
+ onHover,
20961
+ filterValue,
20962
+ hasItems,
20963
+ rootClientId: destinationRootClientId
20964
+ }
20965
+ }, fills => {
20966
+ if (fills.length) {
20967
+ return fills;
20968
+ }
20969
 
20970
+ if (!hasItems) {
20971
+ return (0,external_wp_element_namespaceObject.createElement)(no_results, null);
20972
+ }
20973
 
20974
+ return null;
20975
+ }));
20976
+ }
20977
 
20978
+ /* harmony default export */ var search_results = (InserterSearchResults);
20979
+ //# sourceMappingURL=search-results.js.map
20980
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/tabs.js
20981
 
20982
 
20983
  /**
20984
+ * WordPress dependencies
20985
  */
20986
 
20987
 
20988
 
20989
+ const blocksTab = {
20990
+ name: 'blocks',
20991
 
20992
+ /* translators: Blocks tab title in the block inserter. */
20993
+ title: (0,external_wp_i18n_namespaceObject.__)('Blocks')
20994
+ };
20995
+ const patternsTab = {
20996
+ name: 'patterns',
20997
 
20998
+ /* translators: Patterns tab title in the block inserter. */
20999
+ title: (0,external_wp_i18n_namespaceObject.__)('Patterns')
21000
+ };
21001
+ const reusableBlocksTab = {
21002
+ name: 'reusable',
21003
 
21004
+ /* translators: Reusable blocks tab title in the block inserter. */
21005
+ title: (0,external_wp_i18n_namespaceObject.__)('Reusable')
21006
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
21007
 
21008
+ function InserterTabs({
21009
  children,
21010
+ showPatterns = false,
21011
+ showReusableBlocks = false,
21012
+ onSelect
21013
+ }) {
21014
+ const tabs = (0,external_wp_element_namespaceObject.useMemo)(() => {
21015
+ const tempTabs = [blocksTab];
 
 
 
 
 
 
 
 
 
21016
 
21017
+ if (showPatterns) {
21018
+ tempTabs.push(patternsTab);
21019
+ }
21020
 
21021
+ if (showReusableBlocks) {
21022
+ tempTabs.push(reusableBlocksTab);
21023
+ }
21024
 
21025
+ return tempTabs;
21026
+ }, [blocksTab, showPatterns, patternsTab, showReusableBlocks, reusableBlocksTab]);
21027
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TabPanel, {
21028
+ className: "block-editor-inserter__tabs",
21029
+ tabs: tabs,
21030
+ onSelect: onSelect
21031
+ }, children);
21032
+ }
21033
 
21034
+ /* harmony default export */ var tabs = (InserterTabs);
21035
+ //# sourceMappingURL=tabs.js.map
21036
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/menu.js
21037
 
 
 
 
21038
 
21039
  /**
21040
  * WordPress dependencies
21043
 
21044
 
21045
 
 
21046
  /**
21047
  * Internal dependencies
21048
  */
21049
 
21050
 
21051
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21052
 
21053
 
 
 
 
 
 
21054
 
21055
 
 
 
 
21056
 
 
 
 
21057
 
 
 
 
 
 
 
21058
 
 
 
21059
 
21060
+ function InserterMenu({
21061
+ rootClientId,
21062
+ clientId,
21063
+ isAppender,
21064
+ __experimentalInsertionIndex,
21065
+ onSelect,
21066
+ showInserterHelpPanel,
21067
+ showMostUsedBlocks,
21068
+ __experimentalFilterValue = '',
21069
+ shouldFocusBlock = true
21070
+ }) {
21071
+ const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(__experimentalFilterValue);
21072
+ const [hoveredItem, setHoveredItem] = (0,external_wp_element_namespaceObject.useState)(null);
21073
+ const [selectedPatternCategory, setSelectedPatternCategory] = (0,external_wp_element_namespaceObject.useState)(null);
21074
+ const [destinationRootClientId, onInsertBlocks, onToggleInsertionPoint] = use_insertion_point({
21075
+ rootClientId,
21076
+ clientId,
21077
+ isAppender,
21078
+ insertionIndex: __experimentalInsertionIndex,
21079
+ shouldFocusBlock
21080
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21081
  const {
21082
+ showPatterns,
21083
+ hasReusableBlocks
21084
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
21085
+ var _getSettings$__experi;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21086
 
21087
+ const {
21088
+ __experimentalGetAllowedPatterns,
21089
+ getSettings
21090
+ } = select(store);
21091
+ return {
21092
+ showPatterns: !!__experimentalGetAllowedPatterns(destinationRootClientId).length,
21093
+ hasReusableBlocks: !!((_getSettings$__experi = getSettings().__experimentalReusableBlocks) !== null && _getSettings$__experi !== void 0 && _getSettings$__experi.length)
21094
+ };
21095
+ }, [destinationRootClientId]);
21096
+ const onInsert = (0,external_wp_element_namespaceObject.useCallback)((blocks, meta, shouldForceFocusBlock) => {
21097
+ onInsertBlocks(blocks, meta, shouldForceFocusBlock);
21098
+ onSelect();
21099
+ }, [onInsertBlocks, onSelect]);
21100
+ const onInsertPattern = (0,external_wp_element_namespaceObject.useCallback)((blocks, patternName) => {
21101
+ onInsertBlocks(blocks, {
21102
+ patternName
21103
+ });
21104
+ onSelect();
21105
+ }, [onInsertBlocks, onSelect]);
21106
+ const onHover = (0,external_wp_element_namespaceObject.useCallback)(item => {
21107
+ onToggleInsertionPoint(!!item);
21108
+ setHoveredItem(item);
21109
+ }, [onToggleInsertionPoint, setHoveredItem]);
21110
+ const onClickPatternCategory = (0,external_wp_element_namespaceObject.useCallback)(patternCategory => {
21111
+ setSelectedPatternCategory(patternCategory);
21112
+ }, [setSelectedPatternCategory]);
21113
+ const blocksTab = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
21114
+ className: "block-editor-inserter__block-list"
21115
+ }, (0,external_wp_element_namespaceObject.createElement)(block_types_tab, {
21116
+ rootClientId: destinationRootClientId,
21117
+ onInsert: onInsert,
21118
+ onHover: onHover,
21119
+ showMostUsedBlocks: showMostUsedBlocks
21120
+ })), showInserterHelpPanel && (0,external_wp_element_namespaceObject.createElement)("div", {
21121
+ className: "block-editor-inserter__tips"
21122
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
21123
+ as: "h2"
21124
+ }, (0,external_wp_i18n_namespaceObject.__)('A tip for using the block editor')), (0,external_wp_element_namespaceObject.createElement)(tips, null))), [destinationRootClientId, onInsert, onHover, filterValue, showMostUsedBlocks, showInserterHelpPanel]);
21125
+ const patternsTab = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_wp_element_namespaceObject.createElement)(block_patterns_tab, {
21126
+ rootClientId: destinationRootClientId,
21127
+ onInsert: onInsertPattern,
21128
+ onClickCategory: onClickPatternCategory,
21129
+ selectedCategory: selectedPatternCategory
21130
+ }), [destinationRootClientId, onInsertPattern, onClickPatternCategory, selectedPatternCategory]);
21131
+ const reusableBlocksTab = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_wp_element_namespaceObject.createElement)(reusable_blocks_tab, {
21132
+ rootClientId: destinationRootClientId,
21133
+ onInsert: onInsert,
21134
+ onHover: onHover
21135
+ }), [destinationRootClientId, onInsert, onHover]);
21136
+ const getCurrentTab = (0,external_wp_element_namespaceObject.useCallback)(tab => {
21137
+ if (tab.name === 'blocks') {
21138
+ return blocksTab;
21139
+ } else if (tab.name === 'patterns') {
21140
+ return patternsTab;
21141
  }
 
 
 
21142
 
21143
+ return reusableBlocksTab;
21144
+ }, [blocksTab, patternsTab, reusableBlocksTab]);
21145
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
21146
+ className: "block-editor-inserter__menu"
21147
+ }, (0,external_wp_element_namespaceObject.createElement)("div", {
21148
+ className: "block-editor-inserter__main-area"
21149
+ }, (0,external_wp_element_namespaceObject.createElement)("div", {
21150
+ className: "block-editor-inserter__content"
21151
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SearchControl, {
21152
+ className: "block-editor-inserter__search",
21153
+ onChange: value => {
21154
+ if (hoveredItem) setHoveredItem(null);
21155
+ setFilterValue(value);
21156
+ },
21157
+ value: filterValue,
21158
+ label: (0,external_wp_i18n_namespaceObject.__)('Search for blocks and patterns'),
21159
+ placeholder: (0,external_wp_i18n_namespaceObject.__)('Search')
21160
+ }), !!filterValue && (0,external_wp_element_namespaceObject.createElement)(search_results, {
21161
+ filterValue: filterValue,
21162
+ onSelect: onSelect,
21163
+ onHover: onHover,
21164
+ rootClientId: rootClientId,
21165
+ clientId: clientId,
21166
+ isAppender: isAppender,
21167
+ __experimentalInsertionIndex: __experimentalInsertionIndex,
21168
+ showBlockDirectory: true,
21169
+ shouldFocusBlock: shouldFocusBlock
21170
+ }), !filterValue && (showPatterns || hasReusableBlocks) && (0,external_wp_element_namespaceObject.createElement)(tabs, {
21171
+ showPatterns: showPatterns,
21172
+ showReusableBlocks: hasReusableBlocks
21173
+ }, getCurrentTab), !filterValue && !showPatterns && !hasReusableBlocks && blocksTab)), showInserterHelpPanel && hoveredItem && (0,external_wp_element_namespaceObject.createElement)(preview_panel, {
21174
+ item: hoveredItem
21175
+ }));
21176
  }
21177
 
21178
+ /* harmony default export */ var menu = (InserterMenu);
21179
+ //# sourceMappingURL=menu.js.map
21180
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/quick-inserter.js
 
 
 
 
21181
 
 
 
 
 
 
 
 
21182
 
21183
+ /**
21184
+ * External dependencies
21185
+ */
21186
 
21187
+ /**
21188
+ * WordPress dependencies
21189
+ */
21190
 
 
 
 
 
21191
 
 
 
 
21192
 
 
 
 
 
 
 
 
 
21193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21194
 
21195
+ /**
21196
+ * Internal dependencies
21197
+ */
21198
 
 
 
 
 
 
21199
 
 
 
 
 
 
 
21200
 
 
 
 
21201
 
21202
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21203
 
21204
+ const SEARCH_THRESHOLD = 6;
21205
+ const SHOWN_BLOCK_TYPES = 6;
21206
+ const SHOWN_BLOCK_PATTERNS = 2;
21207
+ function QuickInserter({
21208
+ onSelect,
21209
+ rootClientId,
21210
+ clientId,
21211
+ isAppender
21212
+ }) {
21213
+ const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)('');
21214
+ const [destinationRootClientId, onInsertBlocks] = use_insertion_point({
21215
+ onSelect,
21216
+ rootClientId,
21217
+ clientId,
21218
+ isAppender
21219
+ });
21220
+ const [blockTypes] = use_block_types_state(destinationRootClientId, onInsertBlocks);
21221
+ const [patterns] = use_patterns_state(onInsertBlocks, destinationRootClientId);
21222
+ const showPatterns = patterns.length && !!filterValue;
21223
+ const showSearch = showPatterns && patterns.length > SEARCH_THRESHOLD || blockTypes.length > SEARCH_THRESHOLD;
21224
+ const {
21225
+ setInserterIsOpened,
21226
+ insertionIndex
21227
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
21228
+ const {
21229
+ getSettings,
21230
+ getBlockIndex,
21231
+ getBlockCount
21232
+ } = select(store);
21233
+ const index = getBlockIndex(clientId, rootClientId);
21234
+ return {
21235
+ setInserterIsOpened: getSettings().__experimentalSetIsInserterOpened,
21236
+ insertionIndex: index === -1 ? getBlockCount() : index
21237
+ };
21238
+ }, [clientId, rootClientId]);
21239
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
21240
+ if (setInserterIsOpened) {
21241
+ setInserterIsOpened(false);
21242
  }
21243
+ }, [setInserterIsOpened]); // When clicking Browse All select the appropriate block so as
21244
+ // the insertion point can work as expected
21245
 
21246
+ const onBrowseAll = () => {
21247
+ setInserterIsOpened({
21248
+ rootClientId,
21249
+ insertionIndex,
21250
+ filterValue
 
21251
  });
21252
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21253
 
21254
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
21255
+ className: classnames_default()('block-editor-inserter__quick-inserter', {
21256
+ 'has-search': showSearch,
21257
+ 'has-expand': setInserterIsOpened
21258
+ })
21259
+ }, showSearch && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SearchControl, {
21260
+ className: "block-editor-inserter__search",
21261
+ value: filterValue,
21262
+ onChange: value => {
21263
+ setFilterValue(value);
21264
+ },
21265
+ label: (0,external_wp_i18n_namespaceObject.__)('Search for blocks and patterns'),
21266
+ placeholder: (0,external_wp_i18n_namespaceObject.__)('Search')
21267
+ }), (0,external_wp_element_namespaceObject.createElement)("div", {
21268
+ className: "block-editor-inserter__quick-inserter-results"
21269
+ }, (0,external_wp_element_namespaceObject.createElement)(search_results, {
21270
+ filterValue: filterValue,
21271
+ onSelect: onSelect,
21272
+ rootClientId: rootClientId,
21273
+ clientId: clientId,
21274
+ isAppender: isAppender,
21275
+ maxBlockPatterns: showPatterns ? SHOWN_BLOCK_PATTERNS : 0,
21276
+ maxBlockTypes: SHOWN_BLOCK_TYPES,
21277
+ isDraggable: false
21278
+ })), setInserterIsOpened && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
21279
+ className: "block-editor-inserter__quick-inserter-expand",
21280
+ onClick: onBrowseAll,
21281
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Browse all. This will open the main inserter panel in the editor toolbar.')
21282
+ }, (0,external_wp_i18n_namespaceObject.__)('Browse all')));
21283
+ }
21284
+ //# sourceMappingURL=quick-inserter.js.map
21285
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inserter/index.js
21286
 
21287
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21288
 
21289
+ /**
21290
+ * External dependencies
21291
+ */
21292
 
 
 
 
 
 
 
 
 
 
 
 
21293
 
21294
+ /**
21295
+ * WordPress dependencies
21296
+ */
21297
 
 
 
 
 
21298
 
 
21299
 
 
 
 
 
 
 
 
21300
 
 
 
 
 
 
 
 
 
 
21301
 
21302
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21303
 
21304
 
21305
+
21306
+ /**
21307
+ * Internal dependencies
21308
+ */
 
 
21309
 
21310
 
 
 
 
 
 
 
21311
 
21312
 
 
 
 
 
 
21313
 
21314
+ const defaultRenderToggle = ({
21315
+ onToggle,
21316
+ disabled,
21317
+ isOpen,
21318
+ blockTitle,
21319
+ hasSingleBlockType,
21320
+ toggleProps = {}
21321
+ }) => {
21322
+ let label;
21323
 
21324
+ if (hasSingleBlockType) {
21325
+ label = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name of the block when there is only one
21326
+ (0,external_wp_i18n_namespaceObject._x)('Add %s', 'directly add the only allowed block'), blockTitle);
21327
+ } else {
21328
+ label = (0,external_wp_i18n_namespaceObject._x)('Add block', 'Generic label for block inserter button');
21329
  }
 
 
 
21330
 
21331
+ const {
21332
+ onClick,
21333
+ ...rest
21334
+ } = toggleProps; // Handle both onClick functions from the toggle and the parent component
21335
 
21336
+ function handleClick(event) {
21337
+ if (onToggle) {
21338
+ onToggle(event);
21339
+ }
21340
 
21341
+ if (onClick) {
21342
+ onClick(event);
21343
  }
21344
+ }
21345
 
21346
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({
21347
+ icon: library_plus,
21348
+ label: label,
21349
+ tooltipPosition: "bottom",
21350
+ onClick: handleClick,
21351
+ className: "block-editor-inserter__toggle",
21352
+ "aria-haspopup": !hasSingleBlockType ? 'true' : false,
21353
+ "aria-expanded": !hasSingleBlockType ? isOpen : false,
21354
+ disabled: disabled
21355
+ }, rest));
21356
+ };
21357
+
21358
+ class Inserter extends external_wp_element_namespaceObject.Component {
21359
+ constructor() {
21360
+ super(...arguments);
21361
+ this.onToggle = this.onToggle.bind(this);
21362
+ this.renderToggle = this.renderToggle.bind(this);
21363
+ this.renderContent = this.renderContent.bind(this);
21364
  }
 
 
 
21365
 
21366
+ onToggle(isOpen) {
21367
+ const {
21368
+ onToggle
21369
+ } = this.props; // Surface toggle callback to parent component
21370
 
21371
+ if (onToggle) {
21372
+ onToggle(isOpen);
21373
+ }
21374
  }
21375
  /**
21376
+ * Render callback to display Dropdown toggle element.
21377
+ *
21378
+ * @param {Object} options
21379
+ * @param {Function} options.onToggle Callback to invoke when toggle is
21380
+ * pressed.
21381
+ * @param {boolean} options.isOpen Whether dropdown is currently open.
21382
+ *
21383
+ * @return {WPElement} Dropdown toggle element.
21384
  */
21385
 
21386
 
21387
+ renderToggle({
21388
+ onToggle,
21389
+ isOpen
21390
+ }) {
21391
+ const {
21392
+ disabled,
21393
+ blockTitle,
21394
+ hasSingleBlockType,
21395
+ directInsertBlock,
21396
+ toggleProps,
21397
+ hasItems,
21398
+ renderToggle = defaultRenderToggle
21399
+ } = this.props;
21400
+ return renderToggle({
21401
+ onToggle,
21402
+ isOpen,
21403
+ disabled: disabled || !hasItems,
21404
+ blockTitle,
21405
+ hasSingleBlockType,
21406
+ directInsertBlock,
21407
+ toggleProps
21408
+ });
21409
  }
21410
  /**
21411
+ * Render callback to display Dropdown content element.
21412
+ *
21413
+ * @param {Object} options
21414
+ * @param {Function} options.onClose Callback to invoke when dropdown is
21415
+ * closed.
21416
+ *
21417
+ * @return {WPElement} Dropdown content element.
21418
  */
21419
 
21420
 
21421
+ renderContent({
21422
+ onClose
21423
+ }) {
21424
+ const {
21425
+ rootClientId,
21426
+ clientId,
21427
+ isAppender,
21428
+ showInserterHelpPanel,
21429
+ // This prop is experimental to give some time for the quick inserter to mature
21430
+ // Feel free to make them stable after a few releases.
21431
+ __experimentalIsQuick: isQuick
21432
+ } = this.props;
21433
 
21434
+ if (isQuick) {
21435
+ return (0,external_wp_element_namespaceObject.createElement)(QuickInserter, {
21436
+ onSelect: () => {
21437
+ onClose();
21438
+ },
21439
+ rootClientId: rootClientId,
21440
+ clientId: clientId,
21441
+ isAppender: isAppender
21442
+ });
21443
  }
21444
 
21445
+ return (0,external_wp_element_namespaceObject.createElement)(menu, {
21446
+ onSelect: () => {
21447
+ onClose();
21448
+ },
21449
+ rootClientId: rootClientId,
21450
+ clientId: clientId,
21451
+ isAppender: isAppender,
21452
+ showInserterHelpPanel: showInserterHelpPanel
21453
+ });
21454
+ }
21455
 
21456
+ render() {
21457
+ const {
21458
+ position,
21459
+ hasSingleBlockType,
21460
+ directInsertBlock,
21461
+ insertOnlyAllowedBlock,
21462
+ __experimentalIsQuick: isQuick,
21463
+ onSelectOrClose
21464
+ } = this.props;
21465
 
21466
+ if (hasSingleBlockType || directInsertBlock !== null && directInsertBlock !== void 0 && directInsertBlock.length) {
21467
+ return this.renderToggle({
21468
+ onToggle: insertOnlyAllowedBlock
21469
+ });
21470
  }
21471
 
21472
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
21473
+ className: "block-editor-inserter",
21474
+ contentClassName: classnames_default()('block-editor-inserter__popover', {
21475
+ 'is-quick': isQuick
21476
+ }),
21477
+ position: position,
21478
+ onToggle: this.onToggle,
21479
+ expandOnMobile: true,
21480
+ headerTitle: (0,external_wp_i18n_namespaceObject.__)('Add a block'),
21481
+ renderToggle: this.renderToggle,
21482
+ renderContent: this.renderContent,
21483
+ onClose: onSelectOrClose
21484
  });
21485
  }
 
 
 
21486
 
21487
+ }
21488
 
21489
+ /* harmony default export */ var inserter = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, {
21490
+ clientId,
21491
+ rootClientId
21492
+ }) => {
21493
+ const {
21494
+ getBlockRootClientId,
21495
+ hasInserterItems,
21496
+ __experimentalGetAllowedBlocks,
21497
+ __experimentalGetDirectInsertBlock
21498
+ } = select(store);
21499
+ const {
21500
+ getBlockVariations
21501
+ } = select(external_wp_blocks_namespaceObject.store);
21502
+ rootClientId = rootClientId || getBlockRootClientId(clientId) || undefined;
21503
 
21504
+ const allowedBlocks = __experimentalGetAllowedBlocks(rootClientId);
 
 
21505
 
21506
+ const directInsertBlock = __experimentalGetDirectInsertBlock(rootClientId);
21507
 
21508
+ const hasSingleBlockType = (0,external_lodash_namespaceObject.size)(allowedBlocks) === 1 && (0,external_lodash_namespaceObject.size)(getBlockVariations(allowedBlocks[0].name, 'inserter')) === 0;
21509
+ let allowedBlockType = false;
21510
+
21511
+ if (hasSingleBlockType) {
21512
+ allowedBlockType = allowedBlocks[0];
21513
  }
 
 
 
21514
 
21515
+ return {
21516
+ hasItems: hasInserterItems(rootClientId),
21517
+ hasSingleBlockType,
21518
+ blockTitle: allowedBlockType ? allowedBlockType.title : '',
21519
+ allowedBlockType,
21520
+ directInsertBlock,
21521
+ rootClientId
21522
+ };
21523
+ }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps, {
21524
+ select
21525
+ }) => {
21526
+ return {
21527
+ insertOnlyAllowedBlock() {
21528
+ const {
21529
+ rootClientId,
21530
+ clientId,
21531
+ isAppender,
21532
+ hasSingleBlockType,
21533
+ allowedBlockType,
21534
+ directInsertBlock,
21535
+ onSelectOrClose
21536
+ } = ownProps;
21537
 
21538
+ if (!hasSingleBlockType && !(directInsertBlock !== null && directInsertBlock !== void 0 && directInsertBlock.length)) {
21539
+ return;
21540
+ }
21541
 
21542
+ function getInsertionIndex() {
21543
+ const {
21544
+ getBlockIndex,
21545
+ getBlockSelectionEnd,
21546
+ getBlockOrder,
21547
+ getBlockRootClientId
21548
+ } = select(store); // If the clientId is defined, we insert at the position of the block.
21549
 
21550
+ if (clientId) {
21551
+ return getBlockIndex(clientId, rootClientId);
21552
+ } // If there a selected block, we insert after the selected block.
21553
 
 
21554
 
21555
+ const end = getBlockSelectionEnd();
 
 
21556
 
21557
+ if (!isAppender && end && getBlockRootClientId(end) === rootClientId) {
21558
+ return getBlockIndex(end, rootClientId) + 1;
21559
+ } // Otherwise, we insert at the end of the current rootClientId
21560
 
 
 
 
 
 
 
21561
 
21562
+ return getBlockOrder(rootClientId).length;
21563
+ }
 
 
 
 
21564
 
21565
+ const {
21566
+ insertBlock
21567
+ } = dispatch(store);
21568
+ const blockToInsert = directInsertBlock !== null && directInsertBlock !== void 0 && directInsertBlock.length ? (0,external_wp_blocks_namespaceObject.createBlock)(...directInsertBlock) : (0,external_wp_blocks_namespaceObject.createBlock)(allowedBlockType.name);
21569
+ insertBlock(blockToInsert, getInsertionIndex(), rootClientId);
21570
 
21571
+ if (onSelectOrClose) {
21572
+ onSelectOrClose();
21573
+ }
21574
 
21575
+ const message = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name of the block that has been added
21576
+ (0,external_wp_i18n_namespaceObject.__)('%s block added'), allowedBlockType.title);
21577
+ (0,external_wp_a11y_namespaceObject.speak)(message);
21578
  }
21579
 
21580
+ };
21581
+ }), // The global inserter should always be visible, we are using ( ! isAppender && ! rootClientId && ! clientId ) as
21582
+ // a way to detect the global Inserter.
21583
+ (0,external_wp_compose_namespaceObject.ifCondition)(({
21584
+ hasItems,
21585
+ isAppender,
21586
+ rootClientId,
21587
+ clientId
21588
+ }) => hasItems || !isAppender && !rootClientId && !clientId)])(Inserter));
21589
+ //# sourceMappingURL=index.js.map
21590
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/default-block-appender/index.js
21591
 
 
21592
 
21593
+ /**
21594
+ * External dependencies
21595
+ */
 
 
 
21596
 
21597
+ /**
21598
+ * WordPress dependencies
21599
+ */
21600
 
 
 
 
 
 
21601
 
21602
 
 
 
 
 
21603
 
 
 
 
 
21604
 
 
 
 
21605
 
21606
+ /**
21607
+ * Internal dependencies
21608
+ */
 
 
 
 
 
 
21609
 
21610
 
 
 
 
21611
 
21612
+ /**
21613
+ * Zero width non-breaking space, used as padding for the paragraph when it is
21614
+ * empty.
21615
+ */
21616
 
21617
+ const ZWNBSP = '\ufeff';
21618
+ function DefaultBlockAppender({
21619
+ isLocked,
21620
+ isVisible,
21621
+ onAppend,
21622
+ showPrompt,
21623
+ placeholder,
21624
+ rootClientId
21625
+ }) {
21626
+ if (isLocked || !isVisible) {
21627
+ return null;
21628
+ }
21629
 
21630
+ const value = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)('Type / to choose a block');
21631
 
21632
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
21633
+ "data-root-client-id": rootClientId || '',
21634
+ className: classnames_default()('block-editor-default-block-appender', {
21635
+ 'has-visible-prompt': showPrompt
21636
+ })
21637
+ }, (0,external_wp_element_namespaceObject.createElement)("p", {
21638
+ tabIndex: "0" // Only necessary for `useCanvasClickRedirect` to consider it
21639
+ // as a target. Ideally it should consider any tabbable target,
21640
+ // but the inserter is rendered in place while it should be
21641
+ // rendered in a popover, just like it does for an empty
21642
+ // paragraph block.
21643
+ ,
21644
+ contentEditable: true,
21645
+ suppressContentEditableWarning: true // We want this element to be styled as a paragraph by themes.
21646
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
21647
+ ,
21648
+ role: "button",
21649
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Add block') // A wrapping container for this one already has the wp-block className.
21650
+ ,
21651
+ className: "block-editor-default-block-appender__content",
21652
+ onFocus: onAppend
21653
+ }, showPrompt ? value : ZWNBSP), (0,external_wp_element_namespaceObject.createElement)(inserter, {
21654
+ rootClientId: rootClientId,
21655
+ position: "bottom right",
21656
+ isAppender: true,
21657
+ __experimentalIsQuick: true
21658
+ }));
21659
+ }
21660
+ /* harmony default export */ var default_block_appender = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => {
21661
+ const {
21662
+ getBlockCount,
21663
+ getBlockName,
21664
+ isBlockValid,
21665
+ getSettings,
21666
+ getTemplateLock
21667
+ } = select(store);
21668
+ const isEmpty = !getBlockCount(ownProps.rootClientId);
21669
+ const isLastBlockDefault = getBlockName(ownProps.lastBlockClientId) === (0,external_wp_blocks_namespaceObject.getDefaultBlockName)();
21670
+ const isLastBlockValid = isBlockValid(ownProps.lastBlockClientId);
21671
+ const {
21672
+ bodyPlaceholder
21673
+ } = getSettings();
21674
+ return {
21675
+ isVisible: isEmpty || !isLastBlockDefault || !isLastBlockValid,
21676
+ showPrompt: isEmpty,
21677
+ isLocked: !!getTemplateLock(ownProps.rootClientId),
21678
+ placeholder: bodyPlaceholder
21679
+ };
21680
+ }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps) => {
21681
+ const {
21682
+ insertDefaultBlock,
21683
+ startTyping
21684
+ } = dispatch(store);
21685
+ return {
21686
+ onAppend() {
21687
+ const {
21688
+ rootClientId
21689
+ } = ownProps;
21690
+ insertDefaultBlock(undefined, rootClientId);
21691
+ startTyping();
21692
  }
21693
 
21694
+ };
21695
+ }))(DefaultBlockAppender));
21696
+ //# sourceMappingURL=index.js.map
21697
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/button-block-appender/index.js
21698
+
21699
+
21700
+ /**
21701
+ * External dependencies
21702
+ */
21703
+
21704
+ /**
21705
+ * WordPress dependencies
21706
+ */
21707
 
 
 
 
21708
 
 
 
21709
 
 
 
 
 
21710
 
 
 
 
21711
 
 
 
 
 
 
 
 
 
 
 
21712
 
21713
+ /**
21714
+ * Internal dependencies
21715
+ */
21716
 
 
 
 
21717
 
 
 
 
21718
 
21719
+ function ButtonBlockAppender({
21720
+ rootClientId,
21721
+ className,
21722
+ onFocus,
21723
+ tabIndex
21724
+ }, ref) {
21725
+ return (0,external_wp_element_namespaceObject.createElement)(inserter, {
21726
+ position: "bottom center",
21727
+ rootClientId: rootClientId,
21728
+ __experimentalIsQuick: true,
21729
+ renderToggle: ({
21730
+ onToggle,
21731
+ disabled,
21732
+ isOpen,
21733
+ blockTitle,
21734
+ hasSingleBlockType
21735
+ }) => {
21736
+ let label;
21737
 
21738
+ if (hasSingleBlockType) {
21739
+ label = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: the name of the block when there is only one
21740
+ (0,external_wp_i18n_namespaceObject._x)('Add %s', 'directly add the only allowed block'), blockTitle);
21741
+ } else {
21742
+ label = (0,external_wp_i18n_namespaceObject._x)('Add block', 'Generic label for block inserter button');
21743
+ }
21744
 
21745
+ const isToggleButton = !hasSingleBlockType;
21746
+ let inserterButton = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
21747
+ ref: ref,
21748
+ onFocus: onFocus,
21749
+ tabIndex: tabIndex,
21750
+ className: classnames_default()(className, 'block-editor-button-block-appender'),
21751
+ onClick: onToggle,
21752
+ "aria-haspopup": isToggleButton ? 'true' : undefined,
21753
+ "aria-expanded": isToggleButton ? isOpen : undefined,
21754
+ disabled: disabled,
21755
+ label: label
21756
+ }, !hasSingleBlockType && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
21757
+ as: "span"
21758
+ }, label), (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
21759
+ icon: library_plus
21760
+ }));
21761
 
21762
+ if (isToggleButton || hasSingleBlockType) {
21763
+ inserterButton = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Tooltip, {
21764
+ text: label
21765
+ }, inserterButton);
21766
+ }
21767
 
21768
+ return inserterButton;
21769
+ },
21770
+ isAppender: true
21771
+ });
21772
+ }
21773
+ /**
21774
+ * Use `ButtonBlockAppender` instead.
21775
+ *
21776
+ * @deprecated
21777
+ */
21778
 
21779
 
21780
+ const ButtonBlockerAppender = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
21781
+ external_wp_deprecated_default()(`wp.blockEditor.ButtonBlockerAppender`, {
21782
+ alternative: 'wp.blockEditor.ButtonBlockAppender'
21783
+ });
21784
+ return ButtonBlockAppender(props, ref);
21785
+ });
21786
+ /**
21787
+ * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/button-block-appender/README.md
21788
+ */
21789
 
21790
+ /* harmony default export */ var button_block_appender = ((0,external_wp_element_namespaceObject.forwardRef)(ButtonBlockAppender));
21791
+ //# sourceMappingURL=index.js.map
21792
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list-appender/index.js
21793
 
 
 
 
21794
 
21795
+ /**
21796
+ * External dependencies
21797
+ */
21798
 
 
 
 
21799
 
21800
+ /**
21801
+ * WordPress dependencies
21802
+ */
 
 
 
 
 
21803
 
21804
 
 
 
 
21805
 
21806
+ /**
21807
+ * Internal dependencies
21808
+ */
21809
 
 
21810
 
 
 
 
21811
 
 
21812
 
 
 
 
21813
 
21814
+ function BlockListAppender({
21815
+ blockClientIds,
21816
+ rootClientId,
21817
+ canInsertDefaultBlock,
21818
+ isLocked,
21819
+ renderAppender: CustomAppender,
21820
+ className,
21821
+ selectedBlockClientId,
21822
+ tagName: TagName = 'div'
21823
+ }) {
21824
+ if (isLocked || CustomAppender === false) {
21825
+ return null;
21826
  }
 
 
 
21827
 
21828
+ let appender;
21829
 
21830
+ if (CustomAppender) {
21831
+ // Prefer custom render prop if provided.
21832
+ appender = (0,external_wp_element_namespaceObject.createElement)(CustomAppender, null);
21833
+ } else {
21834
+ const isDocumentAppender = !rootClientId;
21835
+ const isParentSelected = selectedBlockClientId === rootClientId;
21836
+ const isAnotherDefaultAppenderAlreadyDisplayed = selectedBlockClientId && !blockClientIds.includes(selectedBlockClientId);
21837
 
21838
+ if (!isDocumentAppender && !isParentSelected && (!selectedBlockClientId || isAnotherDefaultAppenderAlreadyDisplayed)) {
21839
+ return null;
21840
  }
21841
 
21842
+ if (canInsertDefaultBlock) {
21843
+ // Render the default block appender when renderAppender has not been
21844
+ // provided and the context supports use of the default appender.
21845
+ appender = (0,external_wp_element_namespaceObject.createElement)(default_block_appender, {
21846
+ rootClientId: rootClientId,
21847
+ lastBlockClientId: (0,external_lodash_namespaceObject.last)(blockClientIds)
21848
+ });
21849
+ } else {
21850
+ // Fallback in the case no renderAppender has been provided and the
21851
+ // default block can't be inserted.
21852
+ appender = (0,external_wp_element_namespaceObject.createElement)(button_block_appender, {
21853
+ rootClientId: rootClientId,
21854
+ className: "block-list-appender__toggle"
21855
+ });
21856
+ }
21857
  }
 
 
 
21858
 
21859
+ return (0,external_wp_element_namespaceObject.createElement)(TagName // A `tabIndex` is used on the wrapping `div` element in order to
21860
+ // force a focus event to occur when an appender `button` element
21861
+ // is clicked. In some browsers (Firefox, Safari), button clicks do
21862
+ // not emit a focus event, which could cause this event to propagate
21863
+ // unexpectedly. The `tabIndex` ensures that the interaction is
21864
+ // captured as a focus, without also adding an extra tab stop.
21865
+ //
21866
+ // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus
21867
+ , {
21868
+ tabIndex: -1,
21869
+ className: classnames_default()('block-list-appender wp-block', className) // The appender exists to let you add the first Paragraph before
21870
+ // any is inserted. To that end, this appender should visually be
21871
+ // presented as a block. That means theme CSS should style it as if
21872
+ // it were an empty paragraph block. That means a `wp-block` class to
21873
+ // ensure the width is correct, and a [data-block] attribute to ensure
21874
+ // the correct margin is applied, especially for classic themes which
21875
+ // have commonly targeted that attribute for margins.
21876
+ ,
21877
+ "data-block": true
21878
+ }, appender);
21879
+ }
21880
 
21881
+ /* harmony default export */ var block_list_appender = ((0,external_wp_data_namespaceObject.withSelect)((select, {
21882
+ rootClientId
21883
+ }) => {
21884
+ const {
21885
+ getBlockOrder,
21886
+ canInsertBlockType,
21887
+ getTemplateLock,
21888
+ getSelectedBlockClientId
21889
+ } = select(store);
21890
+ return {
21891
+ isLocked: !!getTemplateLock(rootClientId),
21892
+ blockClientIds: getBlockOrder(rootClientId),
21893
+ canInsertDefaultBlock: canInsertBlockType((0,external_wp_blocks_namespaceObject.getDefaultBlockName)(), rootClientId),
21894
+ selectedBlockClientId: getSelectedBlockClientId()
21895
+ };
21896
+ })(BlockListAppender));
21897
+ //# sourceMappingURL=index.js.map
21898
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-tools/use-popover-scroll.js
21899
+ /**
21900
+ * WordPress dependencies
21901
+ */
21902
 
21903
+ /**
21904
+ * Allow scrolling "through" popovers over the canvas. This is only called for
21905
+ * as long as the pointer is over a popover. Do not use React events because it
21906
+ * will bubble through portals.
21907
+ *
21908
+ * @param {Object} scrollableRef
21909
+ */
21910
+
21911
+ function usePopoverScroll(scrollableRef) {
21912
+ return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
21913
+ if (!scrollableRef) {
21914
  return;
21915
  }
21916
 
21917
+ function onWheel(event) {
21918
+ const {
21919
+ deltaX,
21920
+ deltaY
21921
+ } = event;
21922
+ scrollableRef.current.scrollBy(deltaX, deltaY);
21923
+ } // Tell the browser that we do not call event.preventDefault
21924
+ // See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners
21925
 
 
 
 
21926
 
21927
+ const options = {
21928
+ passive: true
21929
+ };
21930
+ node.addEventListener('wheel', onWheel, options);
21931
+ return () => {
21932
+ node.removeEventListener('wheel', onWheel, options);
21933
+ };
21934
+ }, [scrollableRef]);
21935
+ }
21936
+ //# sourceMappingURL=use-popover-scroll.js.map
21937
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-tools/insertion-point.js
21938
 
 
21939
 
21940
+ /**
21941
+ * External dependencies
21942
+ */
 
21943
 
21944
+ /**
21945
+ * WordPress dependencies
21946
+ */
21947
 
 
 
 
 
 
 
 
 
 
21948
 
21949
 
 
 
 
21950
 
 
 
 
21951
 
 
 
21952
 
21953
+ /**
21954
+ * Internal dependencies
21955
+ */
21956
 
 
21957
 
 
 
 
21958
 
 
 
 
 
 
 
 
 
 
 
21959
 
21960
 
21961
+ const InsertionPointOpenRef = (0,external_wp_element_namespaceObject.createContext)();
 
 
21962
 
21963
+ function InsertionPointPopover({
21964
+ __unstablePopoverSlot,
21965
+ __unstableContentRef
21966
+ }) {
21967
+ const {
21968
+ selectBlock
21969
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
21970
+ const openRef = (0,external_wp_element_namespaceObject.useContext)(InsertionPointOpenRef);
21971
+ const ref = (0,external_wp_element_namespaceObject.useRef)();
21972
+ const {
21973
+ orientation,
21974
+ previousClientId,
21975
+ nextClientId,
21976
+ rootClientId,
21977
+ isInserterShown
21978
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
21979
+ var _getBlockListSettings;
21980
 
21981
+ const {
21982
+ getBlockOrder,
21983
+ getBlockListSettings,
21984
+ getBlockInsertionPoint,
21985
+ isBlockBeingDragged,
21986
+ getPreviousBlockClientId,
21987
+ getNextBlockClientId
21988
+ } = select(store);
21989
+ const insertionPoint = getBlockInsertionPoint();
21990
+ const order = getBlockOrder(insertionPoint.rootClientId);
21991
 
21992
+ if (!order.length) {
21993
+ return {};
21994
+ }
21995
 
21996
+ let _previousClientId = order[insertionPoint.index - 1];
21997
+ let _nextClientId = order[insertionPoint.index];
21998
 
21999
+ while (isBlockBeingDragged(_previousClientId)) {
22000
+ _previousClientId = getPreviousBlockClientId(_previousClientId);
 
22001
  }
22002
 
22003
+ while (isBlockBeingDragged(_nextClientId)) {
22004
+ _nextClientId = getNextBlockClientId(_nextClientId);
22005
  }
22006
 
22007
+ return {
22008
+ previousClientId: _previousClientId,
22009
+ nextClientId: _nextClientId,
22010
+ orientation: ((_getBlockListSettings = getBlockListSettings(insertionPoint.rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation) || 'vertical',
22011
+ rootClientId: insertionPoint.rootClientId,
22012
+ isInserterShown: insertionPoint === null || insertionPoint === void 0 ? void 0 : insertionPoint.__unstableWithInserter
22013
+ };
22014
+ }, []);
22015
+ const previousElement = useBlockElement(previousClientId);
22016
+ const nextElement = useBlockElement(nextClientId);
22017
+ const isVertical = orientation === 'vertical';
22018
+ const style = (0,external_wp_element_namespaceObject.useMemo)(() => {
22019
+ if (!previousElement && !nextElement) {
22020
+ return {};
22021
+ }
22022
 
22023
+ const previousRect = previousElement ? previousElement.getBoundingClientRect() : null;
22024
+ const nextRect = nextElement ? nextElement.getBoundingClientRect() : null;
22025
 
22026
+ if (isVertical) {
22027
+ return {
22028
+ width: previousElement ? previousElement.offsetWidth : nextElement.offsetWidth,
22029
+ height: nextRect && previousRect ? nextRect.top - previousRect.bottom : 0
22030
+ };
22031
+ }
22032
 
22033
+ let width = 0;
22034
 
22035
+ if (previousRect && nextRect) {
22036
+ width = (0,external_wp_i18n_namespaceObject.isRTL)() ? previousRect.left - nextRect.right : nextRect.left - previousRect.right;
22037
+ }
 
22038
 
22039
+ return {
22040
+ width,
22041
+ height: previousElement ? previousElement.offsetHeight : nextElement.offsetHeight
22042
+ };
22043
+ }, [previousElement, nextElement]);
22044
+ const getAnchorRect = (0,external_wp_element_namespaceObject.useCallback)(() => {
22045
+ if (!previousElement && !nextElement) {
22046
+ return {};
22047
+ }
22048
 
22049
+ const {
22050
+ ownerDocument
22051
+ } = previousElement || nextElement;
22052
+ const previousRect = previousElement ? previousElement.getBoundingClientRect() : null;
22053
+ const nextRect = nextElement ? nextElement.getBoundingClientRect() : null;
22054
 
22055
+ if (isVertical) {
22056
+ if ((0,external_wp_i18n_namespaceObject.isRTL)()) {
22057
+ return {
22058
+ top: previousRect ? previousRect.bottom : nextRect.top,
22059
+ left: previousRect ? previousRect.right : nextRect.right,
22060
+ right: previousRect ? previousRect.left : nextRect.left,
22061
+ bottom: nextRect ? nextRect.top : previousRect.bottom,
22062
+ ownerDocument
22063
+ };
22064
  }
22065
 
22066
+ return {
22067
+ top: previousRect ? previousRect.bottom : nextRect.top,
22068
+ left: previousRect ? previousRect.left : nextRect.left,
22069
+ right: previousRect ? previousRect.right : nextRect.right,
22070
+ bottom: nextRect ? nextRect.top : previousRect.bottom,
22071
+ ownerDocument
22072
  };
 
 
 
 
 
 
 
 
 
 
 
 
22073
  }
22074
 
22075
+ if ((0,external_wp_i18n_namespaceObject.isRTL)()) {
22076
+ return {
22077
+ top: previousRect ? previousRect.top : nextRect.top,
22078
+ left: previousRect ? previousRect.left : nextRect.right,
22079
+ right: nextRect ? nextRect.right : previousRect.left,
22080
+ bottom: previousRect ? previousRect.bottom : nextRect.bottom,
22081
+ ownerDocument
22082
+ };
 
 
 
 
 
22083
  }
22084
 
22085
+ return {
22086
+ top: previousRect ? previousRect.top : nextRect.top,
22087
+ left: previousRect ? previousRect.right : nextRect.left,
22088
+ right: nextRect ? nextRect.left : previousRect.right,
22089
+ bottom: previousRect ? previousRect.bottom : nextRect.bottom,
22090
+ ownerDocument
22091
+ };
22092
+ }, [previousElement, nextElement]);
22093
+ const popoverScrollRef = usePopoverScroll(__unstableContentRef);
22094
+ const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
22095
+ const className = classnames_default()('block-editor-block-list__insertion-point', 'is-' + orientation);
 
 
22096
 
22097
+ function onClick(event) {
22098
+ if (event.target === ref.current && nextClientId) {
22099
+ selectBlock(nextClientId, -1);
22100
+ }
22101
+ }
 
22102
 
22103
+ function onFocus(event) {
22104
+ // Only handle click on the wrapper specifically, and not an event
22105
+ // bubbled from the inserter itself.
22106
+ if (event.target !== ref.current) {
22107
+ openRef.current = true;
22108
+ }
22109
+ } // Only show the in-between inserter between blocks, so when there's a
22110
+ // previous and a next element.
22111
 
 
 
 
22112
 
22113
+ const showInsertionPointInserter = previousElement && nextElement && isInserterShown; // Define animation variants for the line element.
 
22114
 
22115
+ const horizontalLine = {
22116
+ start: {
22117
+ width: 0,
22118
+ top: '50%',
22119
+ bottom: '50%',
22120
+ x: 0
22121
+ },
22122
+ rest: {
22123
+ width: 4,
22124
+ top: 0,
22125
+ bottom: 0,
22126
+ x: -2
22127
+ },
22128
+ hover: {
22129
+ width: 4,
22130
+ top: 0,
22131
+ bottom: 0,
22132
+ x: -2
22133
  }
22134
+ };
22135
+ const verticalLine = {
22136
+ start: {
22137
+ height: 0,
22138
+ left: '50%',
22139
+ right: '50%',
22140
+ y: 0
22141
+ },
22142
+ rest: {
22143
+ height: 4,
22144
+ left: 0,
22145
+ right: 0,
22146
+ y: -2
22147
+ },
22148
+ hover: {
22149
+ height: 4,
22150
+ left: 0,
22151
+ right: 0,
22152
+ y: -2
22153
+ }
22154
+ };
22155
+ const lineVariants = {
22156
+ // Initial position starts from the center and invisible.
22157
+ start: { ...(!isVertical ? horizontalLine.start : verticalLine.start),
22158
+ opacity: 0
22159
+ },
22160
+ // The line expands to fill the container. If the inserter is visible it
22161
+ // is delayed so it appears orchestrated.
22162
+ rest: { ...(!isVertical ? horizontalLine.rest : verticalLine.rest),
22163
+ opacity: 1,
22164
+ borderRadius: '2px',
22165
+ transition: {
22166
+ delay: showInsertionPointInserter ? 0.4 : 0
22167
+ }
22168
+ },
22169
+ hover: { ...(!isVertical ? horizontalLine.hover : verticalLine.hover),
22170
+ opacity: 1,
22171
+ borderRadius: '2px',
22172
+ transition: {
22173
+ delay: 0.4
22174
+ }
22175
+ }
22176
+ };
22177
+ const inserterVariants = {
22178
+ start: {
22179
+ scale: disableMotion ? 1 : 0
22180
+ },
22181
+ rest: {
22182
+ scale: 1,
22183
+ transition: {
22184
+ delay: 0.2
22185
+ }
22186
+ }
22187
+ };
22188
+ /* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
22189
+ // While ideally it would be enough to capture the
22190
+ // bubbling focus event from the Inserter, due to the
22191
+ // characteristics of click focusing of `button`s in
22192
+ // Firefox and Safari, it is not reliable.
22193
+ //
22194
+ // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus
22195
 
22196
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
22197
+ ref: popoverScrollRef,
22198
+ noArrow: true,
22199
+ animate: false,
22200
+ getAnchorRect: getAnchorRect,
22201
+ focusOnMount: false,
22202
+ className: "block-editor-block-list__insertion-point-popover" // Render in the old slot if needed for backward compatibility,
22203
+ // otherwise render in place (not in the the default popover slot).
22204
+ ,
22205
+ __unstableSlotName: __unstablePopoverSlot || null // Forces a remount of the popover when its position changes
22206
+ // This makes sure the popover doesn't animate from its previous position.
22207
+ ,
22208
+ key: nextClientId + '--' + rootClientId
22209
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
22210
+ layout: !disableMotion,
22211
+ initial: disableMotion ? 'rest' : 'start',
22212
+ animate: "rest",
22213
+ whileHover: "hover",
22214
+ whileTap: "pressed",
22215
+ exit: "start",
22216
+ ref: ref,
22217
+ tabIndex: -1,
22218
+ onClick: onClick,
22219
+ onFocus: onFocus,
22220
+ className: classnames_default()(className, {
22221
+ 'is-with-inserter': showInsertionPointInserter
22222
+ }),
22223
+ style: style
22224
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
22225
+ variants: lineVariants,
22226
+ className: "block-editor-block-list__insertion-point-indicator"
22227
+ }), showInsertionPointInserter && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
22228
+ variants: inserterVariants,
22229
+ className: classnames_default()('block-editor-block-list__insertion-point-inserter')
22230
+ }, (0,external_wp_element_namespaceObject.createElement)(inserter, {
22231
+ position: "bottom center",
22232
+ clientId: nextClientId,
22233
+ rootClientId: rootClientId,
22234
+ __experimentalIsQuick: true,
22235
+ onToggle: isOpen => {
22236
+ openRef.current = isOpen;
22237
+ },
22238
+ onSelectOrClose: () => {
22239
+ openRef.current = false;
22240
+ }
22241
+ }))));
22242
+ /* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
22243
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22244
 
22245
+ function InsertionPoint({
22246
+ children,
22247
+ __unstablePopoverSlot,
22248
+ __unstableContentRef
22249
+ }) {
22250
+ const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => {
22251
+ return select(store).isBlockInsertionPointVisible();
22252
+ }, []);
22253
+ return (0,external_wp_element_namespaceObject.createElement)(InsertionPointOpenRef.Provider, {
22254
+ value: (0,external_wp_element_namespaceObject.useRef)(false)
22255
+ }, isVisible && (0,external_wp_element_namespaceObject.createElement)(InsertionPointPopover, {
22256
+ __unstablePopoverSlot: __unstablePopoverSlot,
22257
+ __unstableContentRef: __unstableContentRef
22258
+ }), children);
22259
  }
22260
+ //# sourceMappingURL=insertion-point.js.map
22261
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-list/use-in-between-inserter.js
22262
  /**
22263
+ * WordPress dependencies
22264
  */
22265
 
22266
 
 
 
 
 
 
 
 
22267
 
 
 
 
22268
  /**
22269
+ * Internal dependencies
22270
  */
22271
 
22272
 
 
 
 
 
 
 
22273
 
22274
+ function useInBetweenInserter() {
22275
+ const openRef = (0,external_wp_element_namespaceObject.useContext)(InsertionPointOpenRef);
22276
+ const hasReducedUI = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getSettings().hasReducedUI, []);
22277
+ const {
22278
+ getBlockListSettings,
22279
+ getBlockRootClientId,
22280
+ getBlockIndex,
22281
+ isBlockInsertionPointVisible,
22282
+ isMultiSelecting,
22283
+ getSelectedBlockClientIds,
22284
+ getTemplateLock
22285
+ } = (0,external_wp_data_namespaceObject.useSelect)(store);
22286
+ const {
22287
+ showInsertionPoint,
22288
+ hideInsertionPoint
22289
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
22290
+ return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
22291
+ if (hasReducedUI) {
22292
+ return;
22293
  }
 
22294
 
22295
+ function onMouseMove(event) {
22296
+ var _getBlockListSettings, _element$parentElemen;
 
 
 
 
22297
 
22298
+ if (openRef.current) {
22299
+ return;
22300
+ }
22301
 
22302
+ if (isMultiSelecting()) {
22303
+ return;
22304
+ }
22305
 
22306
+ if (!event.target.classList.contains('block-editor-block-list__layout')) {
22307
+ if (isBlockInsertionPointVisible()) {
22308
+ hideInsertionPoint();
22309
+ }
22310
 
22311
+ return;
22312
+ }
 
22313
 
22314
+ let rootClientId;
 
 
 
22315
 
22316
+ if (!event.target.classList.contains('is-root-container')) {
22317
+ const blockElement = !!event.target.getAttribute('data-block') ? event.target : event.target.closest('[data-block]');
22318
+ rootClientId = blockElement.getAttribute('data-block');
22319
+ } // Don't set the insertion point if the template is locked.
 
 
22320
 
22321
 
22322
+ if (getTemplateLock(rootClientId)) {
22323
+ return;
22324
+ }
 
22325
 
22326
+ const orientation = ((_getBlockListSettings = getBlockListSettings(rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation) || 'vertical';
22327
+ const rect = event.target.getBoundingClientRect();
22328
+ const offsetTop = event.clientY - rect.top;
22329
+ const offsetLeft = event.clientX - rect.left;
22330
+ const children = Array.from(event.target.children);
22331
+ let element = children.find(blockEl => {
22332
+ return blockEl.classList.contains('wp-block') && orientation === 'vertical' && blockEl.offsetTop > offsetTop || blockEl.classList.contains('wp-block') && orientation === 'horizontal' && blockEl.offsetLeft > offsetLeft;
22333
+ });
22334
 
22335
+ if (!element) {
22336
+ return;
22337
+ } // The block may be in an alignment wrapper, so check the first direct
22338
+ // child if the element has no ID.
22339
 
 
 
 
 
 
 
22340
 
22341
+ if (!element.id) {
22342
+ element = element.firstElementChild;
22343
 
22344
+ if (!element) {
22345
+ return;
22346
+ }
22347
+ } // Don't show the insertion point if a parent block has an "overlay"
22348
+ // See https://github.com/WordPress/gutenberg/pull/34012#pullrequestreview-727762337
 
22349
 
22350
 
22351
+ const parentOverlay = (_element$parentElemen = element.parentElement) === null || _element$parentElemen === void 0 ? void 0 : _element$parentElemen.closest('.block-editor-block-content-overlay.overlay-active');
 
 
 
 
 
22352
 
22353
+ if (parentOverlay) {
22354
+ return;
22355
+ }
22356
 
22357
+ const clientId = element.id.slice('block-'.length);
 
 
 
 
 
 
22358
 
22359
+ if (!clientId) {
22360
+ return;
22361
+ } // Don't show the inserter when hovering above (conflicts with
22362
+ // block toolbar) or inside selected block(s).
22363
 
 
 
 
 
 
 
22364
 
22365
+ if (getSelectedBlockClientIds().includes(clientId)) {
22366
+ return;
22367
+ }
22368
+
22369
+ const elementRect = element.getBoundingClientRect();
22370
 
22371
+ if (orientation === 'horizontal' && (event.clientY > elementRect.bottom || event.clientY < elementRect.top) || orientation === 'vertical' && (event.clientX > elementRect.right || event.clientX < elementRect.left)) {
22372
+ if (isBlockInsertionPointVisible()) {
22373
+ hideInsertionPoint();
22374
+ }
 
 
22375
 
22376
+ return;
22377
+ }
22378
 
22379
+ const index = getBlockIndex(clientId, rootClientId); // Don't show the in-between inserter before the first block in
22380
+ // the list (preserves the original behaviour).
 
 
 
 
22381
 
22382
+ if (index === 0) {
22383
+ if (isBlockInsertionPointVisible()) {
22384
+ hideInsertionPoint();
22385
+ }
22386
 
22387
+ return;
22388
+ }
 
 
 
 
22389
 
22390
+ showInsertionPoint(rootClientId, index, {
22391
+ __unstableWithInserter: true
22392
+ });
22393
+ }
22394
 
22395
+ node.addEventListener('mousemove', onMouseMove);
22396
+ return () => {
22397
+ node.removeEventListener('mousemove', onMouseMove);
22398
+ };
22399
+ }, [openRef, getBlockListSettings, getBlockRootClientId, getBlockIndex, isBlockInsertionPointVisible, isMultiSelecting, showInsertionPoint, hideInsertionPoint, getSelectedBlockClientIds]);
22400
+ }
22401
+ //# sourceMappingURL=use-in-between-inserter.js.map
22402
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/pre-parse-patterns.js
22403
  /**
22404
+ * WordPress dependencies
22405
  */
22406
 
22407
 
 
 
 
 
22408
  /**
22409
+ * Internal dependencies
22410
  */
22411
 
22412
 
 
 
 
 
 
 
22413
 
22414
+ const requestIdleCallback = (() => {
22415
+ if (typeof window === 'undefined') {
22416
+ return callback => {
22417
+ setTimeout(() => callback(Date.now()), 0);
22418
+ };
22419
+ }
22420
 
22421
+ return window.requestIdleCallback || window.requestAnimationFrame;
22422
+ })();
 
 
 
 
22423
 
22424
+ const cancelIdleCallback = (() => {
22425
+ if (typeof window === 'undefined') {
22426
+ return clearTimeout;
22427
+ }
22428
 
22429
+ return window.cancelIdleCallback || window.cancelAnimationFrame;
22430
+ })();
 
 
 
 
22431
 
22432
+ function usePreParsePatterns() {
22433
+ const patterns = (0,external_wp_data_namespaceObject.useSelect)(_select => _select(store).getSettings().__experimentalBlockPatterns, []);
22434
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
22435
+ if (!(patterns !== null && patterns !== void 0 && patterns.length)) {
22436
+ return;
22437
+ }
22438
 
22439
+ let handle;
22440
+ let index = -1;
22441
 
22442
+ const callback = () => {
22443
+ index++;
 
22444
 
22445
+ if (index >= patterns.length) {
22446
+ return;
22447
+ }
 
 
22448
 
22449
+ (0,external_wp_data_namespaceObject.select)(store).__experimentalGetParsedPattern(patterns[index].name);
22450
 
22451
+ handle = requestIdleCallback(callback);
22452
+ };
 
 
 
 
 
 
22453
 
22454
+ handle = requestIdleCallback(callback);
22455
+ return () => cancelIdleCallback(handle);
22456
+ }, [patterns]);
22457
+ return null;
22458
+ }
22459
+ //# sourceMappingURL=pre-parse-patterns.js.map
22460
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/use-block-display-information/index.js
22461
  /**
22462
+ * WordPress dependencies
22463
  */
22464
 
22465
+
22466
  /**
22467
  * Internal dependencies
22468
  */
22469
 
22470
 
22471
+ /** @typedef {import('@wordpress/blocks').WPIcon} WPIcon */
22472
+
22473
  /**
22474
+ * Contains basic block's information for display reasons.
22475
+ *
22476
+ * @typedef {Object} WPBlockDisplayInformation
22477
+ *
22478
+ * @property {string} title Human-readable block type label.
22479
+ * @property {WPIcon} icon Block type icon.
22480
+ * @property {string} description A detailed block type description.
22481
  */
22482
 
 
22483
  /**
22484
+ * Hook used to try to find a matching block variation and return
22485
+ * the appropriate information for display reasons. In order to
22486
+ * to try to find a match we need to things:
22487
+ * 1. Block's client id to extract it's current attributes.
22488
+ * 2. A block variation should have set `isActive` prop to a proper function.
22489
+ *
22490
+ * If for any reason a block variaton match cannot be found,
22491
+ * the returned information come from the Block Type.
22492
+ * If no blockType is found with the provided clientId, returns null.
22493
+ *
22494
+ * @param {string} clientId Block's client id.
22495
+ * @return {?WPBlockDisplayInformation} Block's display information, or `null` when the block or its type not found.
22496
+ */
22497
+
22498
+ function useBlockDisplayInformation(clientId) {
22499
+ return (0,external_wp_data_namespaceObject.useSelect)(select => {
22500
+ if (!clientId) return null;
22501
+ const {
22502
+ getBlockName,
22503
+ getBlockAttributes
22504
+ } = select(store);
22505
+ const {
22506
+ getBlockType,
22507
+ getActiveBlockVariation
22508
+ } = select(external_wp_blocks_namespaceObject.store);
22509
+ const blockName = getBlockName(clientId);
22510
+ const blockType = getBlockType(blockName);
22511
+ if (!blockType) return null;
22512
+ const attributes = getBlockAttributes(clientId);
22513
+ const match = getActiveBlockVariation(blockName, attributes);
22514
+ const blockTypeInfo = {
22515
+ title: blockType.title,
22516
+ icon: blockType.icon,
22517
+ description: blockType.description,
22518
+ anchor: attributes === null || attributes === void 0 ? void 0 : attributes.anchor
22519
+ };
22520
+ if (!match) return blockTypeInfo;
22521
+ return {
22522
+ title: match.title || blockType.title,
22523
+ icon: match.icon || blockType.icon,
22524
+ description: match.description || blockType.description
22525
+ };
22526
+ }, [clientId]);
22527
+ }
22528
+ //# sourceMappingURL=index.js.map
22529
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-title/index.js
22530
+ /**
22531
+ * External dependencies
22532
  */
22533
 
 
 
 
 
 
22534
  /**
22535
+ * WordPress dependencies
22536
  */
22537
 
22538
 
 
 
 
 
22539
 
 
 
 
22540
  /**
22541
+ * Internal dependencies
22542
  */
22543
 
22544
 
22545
+
 
 
22546
  /**
22547
+ * Renders the block's configured title as a string, or empty if the title
22548
+ * cannot be determined.
22549
+ *
22550
+ * @example
22551
+ *
22552
+ * ```jsx
22553
+ * <BlockTitle clientId="afd1cb17-2c08-4e7a-91be-007ba7ddc3a1" />
22554
+ * ```
22555
+ *
22556
+ * @param {Object} props
22557
+ * @param {string} props.clientId Client ID of block.
22558
+ *
22559
+ * @return {?string} Block title.
22560
  */
22561
 
22562
+ function BlockTitle({
22563
+ clientId
22564
+ }) {
22565
+ const {
22566
+ attributes,
22567
+ name,
22568
+ reusableBlockTitle
22569
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
22570
+ if (!clientId) {
22571
+ return {};
22572
+ }
22573
 
22574
+ const {
22575
+ getBlockName,
22576
+ getBlockAttributes,
22577
+ __experimentalGetReusableBlockTitle
22578
+ } = select(store);
22579
+ const blockName = getBlockName(clientId);
22580
 
22581
+ if (!blockName) {
22582
+ return {};
22583
+ }
22584
 
22585
+ const isReusable = (0,external_wp_blocks_namespaceObject.isReusableBlock)((0,external_wp_blocks_namespaceObject.getBlockType)(blockName));
22586
+ return {
22587
+ attributes: getBlockAttributes(clientId),
22588
+ name: blockName,
22589
+ reusableBlockTitle: isReusable && __experimentalGetReusableBlockTitle(getBlockAttributes(clientId).ref)
22590
+ };
22591
+ }, [clientId]);
22592
+ const blockInformation = useBlockDisplayInformation(clientId);
22593
+ if (!name || !blockInformation) return null;
22594
+ const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
22595
+ const blockLabel = blockType ? (0,external_wp_blocks_namespaceObject.__experimentalGetBlockLabel)(blockType, attributes) : null;
22596
+ const label = reusableBlockTitle || blockLabel; // Label will fallback to the title if no label is defined for the current
22597
+ // label context. If the label is defined we prioritize it over possible
22598
+ // possible block variation title match.
22599
 
22600
+ if (label && label !== blockType.title) {
22601
+ return (0,external_lodash_namespaceObject.truncate)(label, {
22602
+ length: 35
22603
+ });
22604
+ }
22605
 
22606
+ return blockInformation.title;
22607
+ }
22608
+ //# sourceMappingURL=index.js.map
22609
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-draggable/use-scroll-when-dragging.js
22610
  /**
22611
+ * WordPress dependencies
22612
  */
22613
 
22614
 
22615
+ const SCROLL_INACTIVE_DISTANCE_PX = 50;
22616
+ const SCROLL_INTERVAL_MS = 25;
22617
+ const PIXELS_PER_SECOND_PER_PERCENTAGE = 1000;
22618
+ const VELOCITY_MULTIPLIER = PIXELS_PER_SECOND_PER_PERCENTAGE * (SCROLL_INTERVAL_MS / 1000);
22619
  /**
22620
+ * React hook that scrolls the scroll container when a block is being dragged.
22621
+ *
22622
+ * @return {Function[]} `startScrolling`, `scrollOnDragOver`, `stopScrolling`
22623
+ * functions to be called in `onDragStart`, `onDragOver`
22624
+ * and `onDragEnd` events respectively.
22625
  */
22626
 
22627
+ function useScrollWhenDragging() {
22628
+ const dragStartY = (0,external_wp_element_namespaceObject.useRef)(null);
22629
+ const velocityY = (0,external_wp_element_namespaceObject.useRef)(null);
22630
+ const scrollParentY = (0,external_wp_element_namespaceObject.useRef)(null);
22631
+ const scrollEditorInterval = (0,external_wp_element_namespaceObject.useRef)(null); // Clear interval when unmounting.
22632
 
22633
+ (0,external_wp_element_namespaceObject.useEffect)(() => () => {
22634
+ if (scrollEditorInterval.current) {
22635
+ clearInterval(scrollEditorInterval.current);
22636
+ scrollEditorInterval.current = null;
22637
+ }
22638
+ }, []);
22639
+ const startScrolling = (0,external_wp_element_namespaceObject.useCallback)(event => {
22640
+ dragStartY.current = event.clientY; // Find nearest parent(s) to scroll.
22641
 
22642
+ scrollParentY.current = (0,external_wp_dom_namespaceObject.getScrollContainer)(event.target);
22643
+ scrollEditorInterval.current = setInterval(() => {
22644
+ if (scrollParentY.current && velocityY.current) {
22645
+ const newTop = scrollParentY.current.scrollTop + velocityY.current; // Setting `behavior: 'smooth'` as a scroll property seems to hurt performance.
22646
+ // Better to use a small scroll interval.
22647
 
22648
+ scrollParentY.current.scroll({
22649
+ top: newTop
22650
+ });
22651
+ }
22652
+ }, SCROLL_INTERVAL_MS);
22653
+ }, []);
22654
+ const scrollOnDragOver = (0,external_wp_element_namespaceObject.useCallback)(event => {
22655
+ if (!scrollParentY.current) {
22656
+ return;
22657
+ }
22658
 
22659
+ const scrollParentHeight = scrollParentY.current.offsetHeight;
22660
+ const offsetDragStartPosition = dragStartY.current - scrollParentY.current.offsetTop;
22661
+ const offsetDragPosition = event.clientY - scrollParentY.current.offsetTop;
22662
 
22663
+ if (event.clientY > offsetDragStartPosition) {
22664
+ // User is dragging downwards.
22665
+ const moveableDistance = Math.max(scrollParentHeight - offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 0);
22666
+ const dragDistance = Math.max(offsetDragPosition - offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 0);
22667
+ const distancePercentage = dragDistance / moveableDistance;
22668
+ velocityY.current = VELOCITY_MULTIPLIER * distancePercentage;
22669
+ } else if (event.clientY < offsetDragStartPosition) {
22670
+ // User is dragging upwards.
22671
+ const moveableDistance = Math.max(offsetDragStartPosition - SCROLL_INACTIVE_DISTANCE_PX, 0);
22672
+ const dragDistance = Math.max(offsetDragStartPosition - offsetDragPosition - SCROLL_INACTIVE_DISTANCE_PX, 0);
22673
+ const distancePercentage = dragDistance / moveableDistance;
22674
+ velocityY.current = -VELOCITY_MULTIPLIER * distancePercentage;
22675
+ } else {
22676
+ velocityY.current = 0;
22677
+ }
22678
+ }, []);
22679
+
22680
+ const stopScrolling = () => {
22681
+ dragStartY.current = null;
22682
+ scrollParentY.current = null;
22683
 
22684
+ if (scrollEditorInterval.current) {
22685
+ clearInterval(scrollEditorInterval.current);
22686
+ scrollEditorInterval.current = null;
22687
+ }
22688
+ };
22689
 
22690
+ return [startScrolling, scrollOnDragOver, stopScrolling];
22691
+ }
22692
+ //# sourceMappingURL=use-scroll-when-dragging.js.map
22693
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-draggable/index.js
 
 
22694
 
22695
 
 
 
 
 
22696
  /**
22697
+ * WordPress dependencies
22698
  */
22699
 
22700
 
 
 
 
 
 
 
 
22701
 
22702
 
 
 
 
22703
  /**
22704
+ * Internal dependencies
22705
  */
22706
 
22707
 
 
 
 
 
 
 
22708
 
22709
 
 
 
 
 
 
 
22710
 
22711
+ const BlockDraggable = ({
22712
+ children,
22713
+ clientIds,
22714
+ cloneClassname,
22715
+ onDragStart,
22716
+ onDragEnd
22717
+ }) => {
22718
+ const {
22719
+ srcRootClientId,
22720
+ isDraggable,
22721
+ icon
22722
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
22723
+ var _getBlockType;
22724
 
22725
+ const {
22726
+ getBlockRootClientId,
22727
+ getTemplateLock,
22728
+ getBlockName
22729
+ } = select(store);
22730
+ const rootClientId = getBlockRootClientId(clientIds[0]);
22731
+ const templateLock = rootClientId ? getTemplateLock(rootClientId) : null;
22732
+ const blockName = getBlockName(clientIds[0]);
22733
+ return {
22734
+ srcRootClientId: rootClientId,
22735
+ isDraggable: 'all' !== templateLock,
22736
+ icon: (_getBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(blockName)) === null || _getBlockType === void 0 ? void 0 : _getBlockType.icon
22737
+ };
22738
+ }, [clientIds]);
22739
+ const isDragging = (0,external_wp_element_namespaceObject.useRef)(false);
22740
+ const [startScrolling, scrollOnDragOver, stopScrolling] = useScrollWhenDragging();
22741
+ const {
22742
+ startDraggingBlocks,
22743
+ stopDraggingBlocks
22744
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store); // Stop dragging blocks if the block draggable is unmounted
22745
 
22746
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
22747
+ return () => {
22748
+ if (isDragging.current) {
22749
+ stopDraggingBlocks();
22750
+ }
22751
+ };
22752
+ }, []);
22753
+
22754
+ if (!isDraggable) {
22755
+ return children({
22756
+ isDraggable: false
22757
+ });
22758
  }
22759
 
22760
+ const transferData = {
22761
+ type: 'block',
22762
+ srcClientIds: clientIds,
22763
+ srcRootClientId
22764
+ };
22765
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Draggable, {
22766
+ cloneClassname: cloneClassname,
22767
+ __experimentalTransferDataType: "wp-blocks",
22768
+ transferData: transferData,
22769
+ onDragStart: event => {
22770
+ startDraggingBlocks(clientIds);
22771
+ isDragging.current = true;
22772
+ startScrolling(event);
22773
+
22774
+ if (onDragStart) {
22775
+ onDragStart();
22776
+ }
22777
+ },
22778
+ onDragOver: scrollOnDragOver,
22779
+ onDragEnd: () => {
22780
+ stopDraggingBlocks();
22781
+ isDragging.current = false;
22782
+ stopScrolling();
22783
+
22784
+ if (onDragEnd) {
22785
+ onDragEnd();
22786
+ }
22787
+ },
22788
+ __experimentalDragComponent: (0,external_wp_element_namespaceObject.createElement)(BlockDraggableChip, {
22789
+ count: clientIds.length,
22790
+ icon: icon
22791
+ })
22792
+ }, ({
22793
+ onDraggableStart,
22794
+ onDraggableEnd
22795
+ }) => {
22796
+ return children({
22797
+ draggable: true,
22798
+ onDragStart: onDraggableStart,
22799
+ onDragEnd: onDraggableEnd
22800
+ });
22801
+ });
22802
  };
22803
+
22804
+ /* harmony default export */ var block_draggable = (BlockDraggable);
22805
+ //# sourceMappingURL=index.js.map
22806
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-tools/block-selection-button.js
22807
+
22808
+
22809
+
22810
  /**
22811
+ * External dependencies
22812
  */
22813
 
 
 
 
 
22814
  /**
22815
+ * WordPress dependencies
22816
  */
22817
 
22818
 
 
 
22819
 
 
 
 
 
22820
 
 
 
 
 
 
 
 
22821
 
 
 
 
22822
 
22823
 
 
 
 
 
 
 
 
 
 
 
 
 
22824
 
22825
+
 
 
 
 
 
 
 
 
 
 
22826
 
22827
  /**
22828
  * Internal dependencies
22830
 
22831
 
22832
 
 
 
 
 
 
 
 
22833
 
 
 
 
 
 
 
 
 
 
 
22834
 
22835
+
 
 
 
 
 
 
 
 
 
 
 
 
22836
  /**
22837
+ * Block selection button component, displaying the label of the block. If the block
22838
+ * descends from a root block, a button is displayed enabling the user to select
22839
+ * the root block.
22840
  *
22841
+ * @param {string} props Component props.
22842
+ * @param {string} props.clientId Client ID of block.
22843
  *
22844
+ * @return {WPComponent} The component to be rendered.
22845
  */
22846
 
22847
+ function BlockSelectionButton({
22848
+ clientId,
22849
+ rootClientId,
22850
+ blockElement
22851
+ }) {
22852
+ const blockInformation = useBlockDisplayInformation(clientId);
22853
+ const selected = (0,external_wp_data_namespaceObject.useSelect)(select => {
22854
+ var _getBlockListSettings;
22855
 
22856
+ const {
22857
+ getBlock,
22858
+ getBlockIndex,
22859
+ hasBlockMovingClientId,
22860
+ getBlockListSettings
22861
+ } = select(store);
22862
+ const index = getBlockIndex(clientId, rootClientId);
22863
+ const {
22864
+ name,
22865
+ attributes
22866
+ } = getBlock(clientId);
22867
+ const blockMovingMode = hasBlockMovingClientId();
22868
+ return {
22869
+ index,
22870
+ name,
22871
+ attributes,
22872
+ blockMovingMode,
22873
+ orientation: (_getBlockListSettings = getBlockListSettings(rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation
22874
+ };
22875
+ }, [clientId, rootClientId]);
22876
+ const {
22877
+ index,
22878
+ name,
22879
+ attributes,
22880
+ blockMovingMode,
22881
+ orientation
22882
+ } = selected;
22883
+ const {
22884
+ setNavigationMode,
22885
+ removeBlock
22886
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
22887
+ const ref = (0,external_wp_element_namespaceObject.useRef)();
22888
+ const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
22889
+ const label = (0,external_wp_blocks_namespaceObject.__experimentalGetAccessibleBlockLabel)(blockType, attributes, index + 1, orientation); // Focus the breadcrumb in navigation mode.
22890
+
22891
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
22892
+ ref.current.focus();
22893
+ (0,external_wp_a11y_namespaceObject.speak)(label);
22894
+ }, [label]);
22895
+ const {
22896
+ hasBlockMovingClientId,
22897
+ getBlockIndex,
22898
+ getBlockRootClientId,
22899
+ getClientIdsOfDescendants,
22900
+ getSelectedBlockClientId,
22901
+ getMultiSelectedBlocksEndClientId,
22902
+ getPreviousBlockClientId,
22903
+ getNextBlockClientId
22904
+ } = (0,external_wp_data_namespaceObject.useSelect)(store);
22905
+ const {
22906
+ selectBlock,
22907
+ clearSelectedBlock,
22908
+ setBlockMovingClientId,
22909
+ moveBlockToPosition
22910
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
22911
+
22912
+ function onKeyDown(event) {
22913
+ const {
22914
+ keyCode
22915
+ } = event;
22916
+ const isUp = keyCode === external_wp_keycodes_namespaceObject.UP;
22917
+ const isDown = keyCode === external_wp_keycodes_namespaceObject.DOWN;
22918
+ const isLeft = keyCode === external_wp_keycodes_namespaceObject.LEFT;
22919
+ const isRight = keyCode === external_wp_keycodes_namespaceObject.RIGHT;
22920
+ const isTab = keyCode === external_wp_keycodes_namespaceObject.TAB;
22921
+ const isEscape = keyCode === external_wp_keycodes_namespaceObject.ESCAPE;
22922
+ const isEnter = keyCode === external_wp_keycodes_namespaceObject.ENTER;
22923
+ const isSpace = keyCode === external_wp_keycodes_namespaceObject.SPACE;
22924
+ const isShift = event.shiftKey;
22925
+
22926
+ if (keyCode === external_wp_keycodes_namespaceObject.BACKSPACE || keyCode === external_wp_keycodes_namespaceObject.DELETE) {
22927
+ removeBlock(clientId);
22928
+ event.preventDefault();
22929
+ return;
22930
+ }
22931
+
22932
+ const selectedBlockClientId = getSelectedBlockClientId();
22933
+ const selectionEndClientId = getMultiSelectedBlocksEndClientId();
22934
+ const selectionBeforeEndClientId = getPreviousBlockClientId(selectionEndClientId || selectedBlockClientId);
22935
+ const selectionAfterEndClientId = getNextBlockClientId(selectionEndClientId || selectedBlockClientId);
22936
+ const navigateUp = isTab && isShift || isUp;
22937
+ const navigateDown = isTab && !isShift || isDown; // Move out of current nesting level (no effect if at root level).
22938
 
22939
+ const navigateOut = isLeft; // Move into next nesting level (no effect if the current block has no innerBlocks).
22940
 
22941
+ const navigateIn = isRight;
22942
+ let focusedBlockUid;
 
 
 
22943
 
22944
+ if (navigateUp) {
22945
+ focusedBlockUid = selectionBeforeEndClientId;
22946
+ } else if (navigateDown) {
22947
+ focusedBlockUid = selectionAfterEndClientId;
22948
+ } else if (navigateOut) {
22949
+ var _getBlockRootClientId;
22950
 
22951
+ focusedBlockUid = (_getBlockRootClientId = getBlockRootClientId(selectedBlockClientId)) !== null && _getBlockRootClientId !== void 0 ? _getBlockRootClientId : selectedBlockClientId;
22952
+ } else if (navigateIn) {
22953
+ var _getClientIdsOfDescen;
22954
 
22955
+ focusedBlockUid = (_getClientIdsOfDescen = getClientIdsOfDescendants([selectedBlockClientId])[0]) !== null && _getClientIdsOfDescen !== void 0 ? _getClientIdsOfDescen : selectedBlockClientId;
22956
+ }
 
22957
 
22958
+ const startingBlockClientId = hasBlockMovingClientId();
 
 
 
 
 
 
 
 
 
22959
 
22960
+ if (isEscape && startingBlockClientId && !event.defaultPrevented) {
22961
+ setBlockMovingClientId(null);
22962
+ event.preventDefault();
22963
+ }
22964
 
22965
+ if ((isEnter || isSpace) && startingBlockClientId) {
22966
+ const sourceRoot = getBlockRootClientId(startingBlockClientId);
22967
+ const destRoot = getBlockRootClientId(selectedBlockClientId);
22968
+ const sourceBlockIndex = getBlockIndex(startingBlockClientId, sourceRoot);
22969
+ let destinationBlockIndex = getBlockIndex(selectedBlockClientId, destRoot);
 
 
 
 
 
22970
 
22971
+ if (sourceBlockIndex < destinationBlockIndex && sourceRoot === destRoot) {
22972
+ destinationBlockIndex -= 1;
22973
+ }
22974
 
22975
+ moveBlockToPosition(startingBlockClientId, sourceRoot, destRoot, destinationBlockIndex);
22976
+ selectBlock(startingBlockClientId);
22977
+ setBlockMovingClientId(null);
22978
+ }
 
 
 
 
 
 
 
 
22979
 
22980
+ if (navigateDown || navigateUp || navigateOut || navigateIn) {
22981
+ if (focusedBlockUid) {
22982
+ event.preventDefault();
22983
+ selectBlock(focusedBlockUid);
22984
+ } else if (isTab && selectedBlockClientId) {
22985
+ let nextTabbable;
22986
 
22987
+ if (navigateDown) {
22988
+ nextTabbable = external_wp_dom_namespaceObject.focus.tabbable.findNext(blockElement);
 
 
22989
 
22990
+ if (!nextTabbable) {
22991
+ nextTabbable = blockElement.ownerDocument.defaultView.frameElement;
22992
+ nextTabbable = external_wp_dom_namespaceObject.focus.tabbable.findNext(nextTabbable);
22993
+ }
22994
+ } else {
22995
+ nextTabbable = external_wp_dom_namespaceObject.focus.tabbable.findPrevious(blockElement);
22996
+ }
 
22997
 
22998
+ if (nextTabbable) {
22999
+ event.preventDefault();
23000
+ nextTabbable.focus();
23001
+ clearSelectedBlock();
23002
+ }
23003
+ }
23004
  }
23005
  }
23006
 
23007
+ const classNames = classnames_default()('block-editor-block-list__block-selection-button', {
23008
+ 'is-block-moving-mode': !!blockMovingMode
23009
+ });
 
 
 
 
 
 
 
23010
 
23011
+ const dragHandleLabel = (0,external_wp_i18n_namespaceObject.__)('Drag');
23012
 
23013
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
23014
+ className: classNames
23015
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
23016
+ justify: "center",
23017
+ className: "block-editor-block-list__block-selection-button__content"
23018
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(BlockIcon, {
23019
+ icon: blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon,
23020
+ showColors: true
23021
+ })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(block_draggable, {
23022
+ clientIds: [clientId]
23023
+ }, draggableProps => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({
23024
+ icon: drag_handle,
23025
+ className: "block-selection-button_drag-handle",
23026
+ "aria-hidden": "true",
23027
+ label: dragHandleLabel // Should not be able to tab to drag handle as this
23028
+ // button can only be used with a pointer device.
23029
+ ,
23030
+ tabIndex: "-1"
23031
+ }, draggableProps)))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
23032
+ ref: ref,
23033
+ onClick: () => setNavigationMode(false),
23034
+ onKeyDown: onKeyDown,
23035
+ label: label,
23036
+ className: "block-selection-button_select-button"
23037
+ }, (0,external_wp_element_namespaceObject.createElement)(BlockTitle, {
23038
+ clientId: clientId
23039
+ })))));
23040
  }
23041
 
23042
+ /* harmony default export */ var block_selection_button = (BlockSelectionButton);
23043
+ //# sourceMappingURL=block-selection-button.js.map
23044
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/navigable-toolbar/index.js
23045
+
 
 
 
23046
 
 
 
23047
 
 
 
 
23048
  /**
23049
+ * WordPress dependencies
23050
  */
 
23051
 
 
 
 
 
 
23052
 
23053
 
 
 
 
 
 
23054
 
 
 
23055
 
 
 
 
 
 
23056
 
23057
+ function hasOnlyToolbarItem(elements) {
23058
+ const dataProp = 'toolbarItem';
23059
+ return !elements.some(element => !(dataProp in element.dataset));
23060
+ }
23061
 
23062
+ function getAllToolbarItemsIn(container) {
23063
+ return Array.from(container.querySelectorAll('[data-toolbar-item]'));
23064
+ }
 
 
 
23065
 
23066
+ function hasFocusWithin(container) {
23067
+ return container.contains(container.ownerDocument.activeElement);
23068
+ }
23069
 
23070
+ function focusFirstTabbableIn(container) {
23071
+ const [firstTabbable] = external_wp_dom_namespaceObject.focus.tabbable.find(container);
23072
 
23073
+ if (firstTabbable) {
23074
+ firstTabbable.focus();
23075
+ }
23076
+ }
23077
 
23078
+ function useIsAccessibleToolbar(ref) {
23079
+ /*
23080
+ * By default, we'll assume the starting accessible state of the Toolbar
23081
+ * is true, as it seems to be the most common case.
23082
+ *
23083
+ * Transitioning from an (initial) false to true state causes the
23084
+ * <Toolbar /> component to mount twice, which is causing undesired
23085
+ * side-effects. These side-effects appear to only affect certain
23086
+ * E2E tests.
23087
+ *
23088
+ * This was initial discovered in this pull-request:
23089
+ * https://github.com/WordPress/gutenberg/pull/23425
23090
+ */
23091
+ const initialAccessibleToolbarState = true; // By default, it's gonna render NavigableMenu. If all the tabbable elements
23092
+ // inside the toolbar are ToolbarItem components (or derived components like
23093
+ // ToolbarButton), then we can wrap them with the accessible Toolbar
23094
+ // component.
23095
 
23096
+ const [isAccessibleToolbar, setIsAccessibleToolbar] = (0,external_wp_element_namespaceObject.useState)(initialAccessibleToolbarState);
23097
+ const determineIsAccessibleToolbar = (0,external_wp_element_namespaceObject.useCallback)(() => {
23098
+ const tabbables = external_wp_dom_namespaceObject.focus.tabbable.find(ref.current);
23099
+ const onlyToolbarItem = hasOnlyToolbarItem(tabbables);
23100
 
23101
+ if (!onlyToolbarItem) {
23102
+ external_wp_deprecated_default()('Using custom components as toolbar controls', {
23103
+ since: '5.6',
23104
+ alternative: 'ToolbarItem, ToolbarButton or ToolbarDropdownMenu components',
23105
+ link: 'https://developer.wordpress.org/block-editor/components/toolbar-button/#inside-blockcontrols'
23106
+ });
23107
+ }
23108
 
23109
+ setIsAccessibleToolbar(onlyToolbarItem);
23110
+ }, []);
23111
+ (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
23112
+ // Toolbar buttons may be rendered asynchronously, so we use
23113
+ // MutationObserver to check if the toolbar subtree has been modified
23114
+ const observer = new window.MutationObserver(determineIsAccessibleToolbar);
23115
+ observer.observe(ref.current, {
23116
+ childList: true,
23117
+ subtree: true
23118
+ });
23119
+ return () => observer.disconnect();
23120
+ }, [isAccessibleToolbar]);
23121
+ return isAccessibleToolbar;
23122
+ }
23123
 
23124
+ function useToolbarFocus(ref, focusOnMount, isAccessibleToolbar, defaultIndex, onIndexChange) {
23125
+ // Make sure we don't use modified versions of this prop
23126
+ const [initialFocusOnMount] = (0,external_wp_element_namespaceObject.useState)(focusOnMount);
23127
+ const [initialIndex] = (0,external_wp_element_namespaceObject.useState)(defaultIndex);
23128
+ const focusToolbar = (0,external_wp_element_namespaceObject.useCallback)(() => {
23129
+ focusFirstTabbableIn(ref.current);
23130
+ }, []); // Focus on toolbar when pressing alt+F10 when the toolbar is visible
23131
 
23132
+ (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/block-editor/focus-toolbar', focusToolbar);
23133
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
23134
+ if (initialFocusOnMount) {
23135
+ focusToolbar();
23136
  }
23137
+ }, [isAccessibleToolbar, initialFocusOnMount, focusToolbar]);
23138
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
23139
+ // If initialIndex is passed, we focus on that toolbar item when the
23140
+ // toolbar gets mounted and initial focus is not forced.
23141
+ // We have to wait for the next browser paint because block controls aren't
23142
+ // rendered right away when the toolbar gets mounted.
23143
+ let raf = 0;
23144
 
23145
+ if (initialIndex && !initialFocusOnMount) {
23146
+ raf = window.requestAnimationFrame(() => {
23147
+ const items = getAllToolbarItemsIn(ref.current);
23148
+ const index = initialIndex || 0;
23149
 
23150
+ if (items[index] && hasFocusWithin(ref.current)) {
23151
+ items[index].focus();
23152
+ }
23153
+ });
23154
  }
23155
 
23156
+ return () => {
23157
+ window.cancelAnimationFrame(raf);
23158
+ if (!onIndexChange || !ref.current) return; // When the toolbar element is unmounted and onIndexChange is passed, we
23159
+ // pass the focused toolbar item index so it can be hydrated later.
23160
 
23161
+ const items = getAllToolbarItemsIn(ref.current);
23162
+ const index = items.findIndex(item => item.tabIndex === 0);
23163
+ onIndexChange(index);
23164
+ };
23165
+ }, [initialIndex, initialFocusOnMount]);
23166
+ }
23167
+
23168
+ function NavigableToolbar({
23169
+ children,
23170
+ focusOnMount,
23171
+ __experimentalInitialIndex: initialIndex,
23172
+ __experimentalOnIndexChange: onIndexChange,
23173
+ ...props
23174
+ }) {
23175
+ const ref = (0,external_wp_element_namespaceObject.useRef)();
23176
+ const isAccessibleToolbar = useIsAccessibleToolbar(ref);
23177
+ useToolbarFocus(ref, focusOnMount, isAccessibleToolbar, initialIndex, onIndexChange);
23178
 
23179
+ if (isAccessibleToolbar) {
23180
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Toolbar, _extends({
23181
+ label: props['aria-label'],
23182
+ ref: ref
23183
+ }, props), children);
23184
+ }
23185
 
23186
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NavigableMenu, _extends({
23187
+ orientation: "horizontal",
23188
+ role: "toolbar",
23189
+ ref: ref
23190
+ }, props), children);
23191
+ }
23192
 
23193
+ /* harmony default export */ var navigable_toolbar = (NavigableToolbar);
23194
+ //# sourceMappingURL=index.js.map
23195
+ ;// CONCATENATED MODULE: ./packages/icons/build-module/library/chevron-right.js
23196
 
23197
 
23198
  /**
23199
  * WordPress dependencies
23200
  */
23201
 
23202
+ const chevronRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
23203
+ xmlns: "http://www.w3.org/2000/svg",
23204
+ viewBox: "0 0 24 24"
23205
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
23206
+ d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"
23207
+ }));
23208
+ /* harmony default export */ var chevron_right = (chevronRight);
23209
+ //# sourceMappingURL=chevron-right.js.map
23210
+ ;// CONCATENATED MODULE: ./packages/icons/build-module/library/chevron-left.js
23211
+
23212
 
23213
  /**
23214
+ * WordPress dependencies
23215
  */
23216
 
23217
+ const chevronLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
23218
+ xmlns: "http://www.w3.org/2000/svg",
23219
+ viewBox: "0 0 24 24"
23220
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
23221
+ d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"
23222
+ }));
23223
+ /* harmony default export */ var chevron_left = (chevronLeft);
23224
+ //# sourceMappingURL=chevron-left.js.map
23225
+ ;// CONCATENATED MODULE: ./packages/icons/build-module/library/chevron-up.js
23226
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23227
 
23228
+ /**
23229
+ * WordPress dependencies
23230
+ */
 
 
 
 
23231
 
23232
+ const chevronUp = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
23233
+ viewBox: "0 0 24 24",
23234
+ xmlns: "http://www.w3.org/2000/svg"
23235
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
23236
+ d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"
23237
+ }));
23238
+ /* harmony default export */ var chevron_up = (chevronUp);
23239
+ //# sourceMappingURL=chevron-up.js.map
23240
+ ;// CONCATENATED MODULE: ./packages/icons/build-module/library/chevron-down.js
 
 
 
23241
 
23242
 
23243
  /**
23244
  * WordPress dependencies
23245
  */
23246
 
23247
+ const chevronDown = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
23248
+ viewBox: "0 0 24 24",
23249
+ xmlns: "http://www.w3.org/2000/svg"
23250
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
23251
+ d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"
23252
+ }));
23253
+ /* harmony default export */ var chevron_down = (chevronDown);
23254
+ //# sourceMappingURL=chevron-down.js.map
23255
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-mover/mover-description.js
23256
+ /**
23257
+ * WordPress dependencies
23258
+ */
23259
 
23260
  /**
23261
+ * Return a label for the block movement controls depending on block position.
23262
+ *
23263
+ * @param {number} selectedCount Number of blocks selected.
23264
+ * @param {string} type Block type - in the case of a single block, should
23265
+ * define its 'type'. I.e. 'Text', 'Heading', 'Image' etc.
23266
+ * @param {number} firstIndex The index (position - 1) of the first block selected.
23267
+ * @param {boolean} isFirst This is the first block.
23268
+ * @param {boolean} isLast This is the last block.
23269
+ * @param {number} dir Direction of movement (> 0 is considered to be going
23270
+ * down, < 0 is up).
23271
+ * @param {string} orientation The orientation of the block movers, vertical or
23272
+ * horizontal.
23273
+ *
23274
+ * @return {string} Label for the block movement controls.
23275
  */
23276
 
23277
+ function getBlockMoverDescription(selectedCount, type, firstIndex, isFirst, isLast, dir, orientation) {
23278
+ const position = firstIndex + 1;
23279
+
23280
+ const getMovementDirection = moveDirection => {
23281
+ if (moveDirection === 'up') {
23282
+ if (orientation === 'horizontal') {
23283
+ return (0,external_wp_i18n_namespaceObject.isRTL)() ? 'right' : 'left';
23284
+ }
23285
+
23286
+ return 'up';
23287
+ } else if (moveDirection === 'down') {
23288
+ if (orientation === 'horizontal') {
23289
+ return (0,external_wp_i18n_namespaceObject.isRTL)() ? 'left' : 'right';
23290
+ }
23291
 
23292
+ return 'down';
23293
+ }
23294
 
23295
+ return null;
23296
+ };
23297
 
23298
+ if (selectedCount > 1) {
23299
+ return getMultiBlockMoverDescription(selectedCount, firstIndex, isFirst, isLast, dir);
23300
+ }
23301
 
23302
+ if (isFirst && isLast) {
23303
+ return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Type of block (i.e. Text, Image etc)
23304
+ (0,external_wp_i18n_namespaceObject.__)('Block %s is the only block, and cannot be moved'), type);
23305
+ }
23306
 
23307
+ if (dir > 0 && !isLast) {
23308
+ // moving down
23309
+ const movementDirection = getMovementDirection('down');
 
 
 
 
 
 
 
 
 
 
23310
 
23311
+ if (movementDirection === 'down') {
23312
+ return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
23313
+ (0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d down to position %3$d'), type, position, position + 1);
 
 
 
 
 
 
23314
  }
23315
+
23316
+ if (movementDirection === 'left') {
23317
+ return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
23318
+ (0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d left to position %3$d'), type, position, position + 1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23319
  }
 
 
 
 
23320
 
23321
+ if (movementDirection === 'right') {
23322
+ return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
23323
+ (0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d right to position %3$d'), type, position, position + 1);
23324
+ }
23325
+ }
23326
 
23327
+ if (dir > 0 && isLast) {
23328
+ // moving down, and is the last item
23329
+ const movementDirection = getMovementDirection('down');
23330
 
23331
+ if (movementDirection === 'down') {
23332
+ return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc)
23333
+ (0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the end of the content and can’t be moved down'), type);
23334
+ }
23335
 
23336
+ if (movementDirection === 'left') {
23337
+ return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc)
23338
+ (0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the end of the content and can’t be moved left'), type);
23339
+ }
23340
 
23341
+ if (movementDirection === 'right') {
23342
+ return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc)
23343
+ (0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the end of the content and can’t be moved right'), type);
23344
+ }
23345
+ }
23346
 
23347
+ if (dir < 0 && !isFirst) {
23348
+ // moving up
23349
+ const movementDirection = getMovementDirection('up');
23350
 
23351
+ if (movementDirection === 'up') {
23352
+ return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
23353
+ (0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d up to position %3$d'), type, position, position - 1);
23354
+ }
23355
 
23356
+ if (movementDirection === 'left') {
23357
+ return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
23358
+ (0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d left to position %3$d'), type, position, position - 1);
23359
+ }
23360
 
23361
+ if (movementDirection === 'right') {
23362
+ return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc), 2: Position of selected block, 3: New position
23363
+ (0,external_wp_i18n_namespaceObject.__)('Move %1$s block from position %2$d right to position %3$d'), type, position, position - 1);
23364
+ }
23365
+ }
23366
 
23367
+ if (dir < 0 && isFirst) {
23368
+ // moving up, and is the first item
23369
+ const movementDirection = getMovementDirection('up');
23370
 
23371
+ if (movementDirection === 'up') {
23372
+ return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc)
23373
+ (0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the beginning of the content and can’t be moved up'), type);
23374
+ }
23375
 
23376
+ if (movementDirection === 'left') {
23377
+ return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc)
23378
+ (0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the beginning of the content and can’t be moved left'), type);
23379
+ }
 
 
 
 
 
 
 
 
 
 
 
23380
 
23381
+ if (movementDirection === 'right') {
23382
+ return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Type of block (i.e. Text, Image etc)
23383
+ (0,external_wp_i18n_namespaceObject.__)('Block %1$s is at the beginning of the content and can’t be moved right'), type);
23384
+ }
23385
  }
 
 
 
 
 
 
 
 
 
 
23386
  }
23387
  /**
23388
+ * Return a label for the block movement controls depending on block position.
 
 
23389
  *
23390
+ * @param {number} selectedCount Number of blocks selected.
23391
+ * @param {number} firstIndex The index (position - 1) of the first block selected.
23392
+ * @param {boolean} isFirst This is the first block.
23393
+ * @param {boolean} isLast This is the last block.
23394
+ * @param {number} dir Direction of movement (> 0 is considered to be going
23395
+ * down, < 0 is up).
23396
  *
23397
+ * @return {string} Label for the block movement controls.
23398
  */
23399
 
23400
+ function getMultiBlockMoverDescription(selectedCount, firstIndex, isFirst, isLast, dir) {
23401
+ const position = firstIndex + 1;
23402
+
23403
+ if (dir < 0 && isFirst) {
23404
+ return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved up as they are already at the top');
23405
+ }
23406
+
23407
+ if (dir > 0 && isLast) {
23408
+ return (0,external_wp_i18n_namespaceObject.__)('Blocks cannot be moved down as they are already at the bottom');
23409
+ }
23410
+
23411
+ if (dir < 0 && !isFirst) {
23412
+ return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Number of selected blocks, 2: Position of selected blocks
23413
+ (0,external_wp_i18n_namespaceObject._n)('Move %1$d block from position %2$d up by one place', 'Move %1$d blocks from position %2$d up by one place', selectedCount), selectedCount, position);
23414
+ }
23415
+
23416
+ if (dir > 0 && !isLast) {
23417
+ return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: Number of selected blocks, 2: Position of selected blocks
23418
+ (0,external_wp_i18n_namespaceObject._n)('Move %1$d block from position %2$d down by one place', 'Move %1$d blocks from position %2$d down by one place', selectedCount), selectedCount, position);
23419
+ }
23420
+ }
23421
+ //# sourceMappingURL=mover-description.js.map
23422
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-mover/button.js
23423
+
23424
 
23425
 
23426
  /**
23427
+ * External dependencies
23428
  */
23429
 
23430
 
23431
  /**
23432
+ * WordPress dependencies
23433
  */
23434
 
23435
 
23436
 
23437
 
 
 
 
 
23438
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23439
 
23440
+
 
 
23441
  /**
23442
+ * Internal dependencies
23443
  */
23444
 
 
 
 
 
23445
 
23446
 
23447
 
 
 
 
23448
 
23449
+ const getArrowIcon = (direction, orientation) => {
23450
+ if (direction === 'up') {
23451
+ if (orientation === 'horizontal') {
23452
+ return (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left;
23453
+ }
23454
 
23455
+ return chevron_up;
23456
+ } else if (direction === 'down') {
23457
+ if (orientation === 'horizontal') {
23458
+ return (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right;
23459
+ }
23460
 
23461
+ return chevron_down;
23462
+ }
23463
 
23464
+ return null;
23465
+ };
23466
 
23467
+ const getMovementDirectionLabel = (moveDirection, orientation) => {
23468
+ if (moveDirection === 'up') {
23469
+ if (orientation === 'horizontal') {
23470
+ return (0,external_wp_i18n_namespaceObject.isRTL)() ? (0,external_wp_i18n_namespaceObject.__)('Move right') : (0,external_wp_i18n_namespaceObject.__)('Move left');
23471
+ }
23472
+
23473
+ return (0,external_wp_i18n_namespaceObject.__)('Move up');
23474
+ } else if (moveDirection === 'down') {
23475
+ if (orientation === 'horizontal') {
23476
+ return (0,external_wp_i18n_namespaceObject.isRTL)() ? (0,external_wp_i18n_namespaceObject.__)('Move left') : (0,external_wp_i18n_namespaceObject.__)('Move right');
23477
+ }
23478
+
23479
+ return (0,external_wp_i18n_namespaceObject.__)('Move down');
23480
+ }
23481
+
23482
+ return null;
23483
+ };
23484
+
23485
+ const BlockMoverButton = (0,external_wp_element_namespaceObject.forwardRef)(({
23486
+ clientIds,
23487
+ direction,
23488
+ orientation: moverOrientation,
23489
  ...props
23490
+ }, ref) => {
23491
+ const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockMoverButton);
23492
+ const blocksCount = (0,external_lodash_namespaceObject.castArray)(clientIds).length;
23493
+ const {
23494
+ blockType,
23495
+ isDisabled,
23496
+ rootClientId,
23497
+ isFirst,
23498
+ isLast,
23499
+ firstIndex,
23500
+ orientation = 'vertical'
23501
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
23502
+ const {
23503
+ getBlockIndex,
23504
+ getBlockRootClientId,
23505
+ getBlockOrder,
23506
+ getBlock,
23507
+ getBlockListSettings
23508
+ } = select(store);
23509
+ const normalizedClientIds = (0,external_lodash_namespaceObject.castArray)(clientIds);
23510
+ const firstClientId = (0,external_lodash_namespaceObject.first)(normalizedClientIds);
23511
+ const blockRootClientId = getBlockRootClientId(firstClientId);
23512
+ const firstBlockIndex = getBlockIndex(firstClientId, blockRootClientId);
23513
+ const lastBlockIndex = getBlockIndex((0,external_lodash_namespaceObject.last)(normalizedClientIds), blockRootClientId);
23514
+ const blockOrder = getBlockOrder(blockRootClientId);
23515
+ const block = getBlock(firstClientId);
23516
+ const isFirstBlock = firstBlockIndex === 0;
23517
+ const isLastBlock = lastBlockIndex === blockOrder.length - 1;
23518
+ const {
23519
+ orientation: blockListOrientation
23520
+ } = getBlockListSettings(blockRootClientId) || {};
23521
+ return {
23522
+ blockType: block ? (0,external_wp_blocks_namespaceObject.getBlockType)(block.name) : null,
23523
+ isDisabled: direction === 'up' ? isFirstBlock : isLastBlock,
23524
+ rootClientId: blockRootClientId,
23525
+ firstIndex: firstBlockIndex,
23526
+ isFirst: isFirstBlock,
23527
+ isLast: isLastBlock,
23528
+ orientation: moverOrientation || blockListOrientation
23529
  };
23530
+ }, [clientIds, direction]);
23531
+ const {
23532
+ moveBlocksDown,
23533
+ moveBlocksUp
23534
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
23535
+ const moverFunction = direction === 'up' ? moveBlocksUp : moveBlocksDown;
23536
 
23537
+ const onClick = event => {
23538
+ moverFunction(clientIds, rootClientId);
 
23539
 
23540
+ if (props.onClick) {
23541
+ props.onClick(event);
23542
  }
23543
+ };
23544
 
23545
+ const descriptionId = `block-editor-block-mover-button__description-${instanceId}`;
23546
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({
23547
+ ref: ref,
23548
+ className: classnames_default()('block-editor-block-mover-button', `is-${direction}-button`),
23549
+ icon: getArrowIcon(direction, orientation),
23550
+ label: getMovementDirectionLabel(direction, orientation),
23551
+ "aria-describedby": descriptionId
23552
+ }, props, {
23553
+ onClick: isDisabled ? null : onClick,
23554
+ "aria-disabled": isDisabled
23555
+ })), (0,external_wp_element_namespaceObject.createElement)("span", {
23556
+ id: descriptionId,
23557
+ className: "block-editor-block-mover-button__description"
23558
+ }, getBlockMoverDescription(blocksCount, blockType && blockType.title, firstIndex, isFirst, isLast, direction === 'up' ? -1 : 1, orientation)));
23559
+ });
23560
+ const BlockMoverUpButton = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
23561
+ return (0,external_wp_element_namespaceObject.createElement)(BlockMoverButton, _extends({
23562
+ direction: "up",
23563
+ ref: ref
23564
+ }, props));
23565
+ });
23566
+ const BlockMoverDownButton = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => {
23567
+ return (0,external_wp_element_namespaceObject.createElement)(BlockMoverButton, _extends({
23568
+ direction: "down",
23569
+ ref: ref
23570
+ }, props));
23571
+ });
23572
+ //# sourceMappingURL=button.js.map
23573
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-mover/index.js
23574
 
 
 
 
23575
 
23576
 
23577
  /**
23578
+ * External dependencies
23579
  */
23580
 
 
 
 
 
 
 
 
 
 
 
 
 
23581
 
23582
  /**
23583
  * WordPress dependencies
23585
 
23586
 
23587
 
23588
+
23589
+
23590
+
23591
+
23592
  /**
23593
  * Internal dependencies
23594
  */
23595
 
23596
 
23597
+
23598
+
23599
+
23600
+ function BlockMover({
23601
+ isFirst,
23602
+ isLast,
23603
+ clientIds,
23604
+ canMove,
23605
+ isHidden,
23606
+ rootClientId,
23607
+ orientation,
23608
+ hideDragHandle
23609
  }) {
23610
+ const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23611
 
23612
+ const onFocus = () => setIsFocused(true);
23613
 
23614
+ const onBlur = () => setIsFocused(false);
 
 
23615
 
23616
+ if (!canMove || isFirst && isLast && !rootClientId) {
23617
+ return null;
23618
+ }
23619
 
23620
+ const dragHandleLabel = (0,external_wp_i18n_namespaceObject.__)('Drag'); // We emulate a disabled state because forcefully applying the `disabled`
23621
+ // attribute on the buttons while it has focus causes the screen to change
23622
+ // to an unfocused state (body as active element) without firing blur on,
23623
+ // the rendering parent, leaving it unable to react to focus out.
23624
 
23625
 
23626
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
23627
+ className: classnames_default()('block-editor-block-mover', {
23628
+ 'is-visible': isFocused || !isHidden,
23629
+ 'is-horizontal': orientation === 'horizontal'
 
 
 
 
 
 
 
 
 
 
 
 
23630
  })
23631
+ }, !hideDragHandle && (0,external_wp_element_namespaceObject.createElement)(block_draggable, {
23632
+ clientIds: clientIds,
23633
+ cloneClassname: "block-editor-block-mover__drag-clone"
23634
+ }, draggableProps => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({
23635
+ icon: drag_handle,
23636
+ className: "block-editor-block-mover__drag-handle",
23637
+ "aria-hidden": "true",
23638
+ label: dragHandleLabel // Should not be able to tab to drag handle as this
23639
+ // button can only be used with a pointer device.
23640
+ ,
23641
+ tabIndex: "-1"
23642
+ }, draggableProps))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, {
23643
+ className: "block-editor-block-mover__move-button-container"
23644
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
23645
+ onFocus: onFocus,
23646
+ onBlur: onBlur
23647
+ }, itemProps => (0,external_wp_element_namespaceObject.createElement)(BlockMoverUpButton, _extends({
23648
+ clientIds: clientIds
23649
+ }, itemProps))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
23650
+ onFocus: onFocus,
23651
+ onBlur: onBlur
23652
+ }, itemProps => (0,external_wp_element_namespaceObject.createElement)(BlockMoverDownButton, _extends({
23653
+ clientIds: clientIds
23654
+ }, itemProps)))));
23655
+ }
23656
 
23657
+ /* harmony default export */ var block_mover = ((0,external_wp_data_namespaceObject.withSelect)((select, {
23658
+ clientIds
23659
+ }) => {
23660
+ var _getBlockListSettings;
23661
+
23662
+ const {
23663
+ getBlock,
23664
+ getBlockIndex,
23665
+ getBlockListSettings,
23666
+ canMoveBlocks,
23667
+ getBlockOrder,
23668
+ getBlockRootClientId
23669
+ } = select(store);
23670
+ const normalizedClientIds = (0,external_lodash_namespaceObject.castArray)(clientIds);
23671
+ const firstClientId = (0,external_lodash_namespaceObject.first)(normalizedClientIds);
23672
+ const block = getBlock(firstClientId);
23673
+ const rootClientId = getBlockRootClientId((0,external_lodash_namespaceObject.first)(normalizedClientIds));
23674
+ const firstIndex = getBlockIndex(firstClientId, rootClientId);
23675
+ const lastIndex = getBlockIndex((0,external_lodash_namespaceObject.last)(normalizedClientIds), rootClientId);
23676
+ const blockOrder = getBlockOrder(rootClientId);
23677
+ const isFirst = firstIndex === 0;
23678
+ const isLast = lastIndex === blockOrder.length - 1;
23679
+ return {
23680
+ blockType: block ? (0,external_wp_blocks_namespaceObject.getBlockType)(block.name) : null,
23681
+ canMove: canMoveBlocks(clientIds, rootClientId),
23682
+ rootClientId,
23683
+ firstIndex,
23684
+ isFirst,
23685
+ isLast,
23686
+ orientation: (_getBlockListSettings = getBlockListSettings(rootClientId)) === null || _getBlockListSettings === void 0 ? void 0 : _getBlockListSettings.orientation
23687
+ };
23688
+ })(BlockMover));
23689
  //# sourceMappingURL=index.js.map
23690
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-toolbar/utils.js
 
 
 
23691
  /**
23692
  * External dependencies
23693
  */
23697
  */
23698
 
23699
 
23700
+ const {
23701
+ clearTimeout: utils_clearTimeout,
23702
+ setTimeout: utils_setTimeout
23703
+ } = window;
23704
+ const DEBOUNCE_TIMEOUT = 200;
23705
  /**
23706
+ * Hook that creates a showMover state, as well as debounced show/hide callbacks.
23707
+ *
23708
+ * @param {Object} props Component props.
23709
+ * @param {Object} props.ref Element reference.
23710
+ * @param {boolean} props.isFocused Whether the component has current focus.
23711
+ * @param {number} [props.debounceTimeout=250] Debounce timeout in milliseconds.
23712
+ * @param {Function} [props.onChange=noop] Callback function.
23713
  */
23714
 
23715
+ function useDebouncedShowMovers({
23716
+ ref,
23717
+ isFocused,
23718
+ debounceTimeout = DEBOUNCE_TIMEOUT,
23719
+ onChange = external_lodash_namespaceObject.noop
23720
+ }) {
23721
+ const [showMovers, setShowMovers] = (0,external_wp_element_namespaceObject.useState)(false);
23722
+ const timeoutRef = (0,external_wp_element_namespaceObject.useRef)();
23723
 
23724
+ const handleOnChange = nextIsFocused => {
23725
+ if (ref !== null && ref !== void 0 && ref.current) {
23726
+ setShowMovers(nextIsFocused);
23727
+ }
23728
 
23729
+ onChange(nextIsFocused);
23730
+ };
23731
 
23732
+ const getIsHovered = () => {
23733
+ return (ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.matches(':hover');
23734
+ };
 
 
 
 
23735
 
23736
+ const shouldHideMovers = () => {
23737
+ const isHovered = getIsHovered();
23738
+ return !isFocused && !isHovered;
23739
+ };
 
 
23740
 
23741
+ const clearTimeoutRef = () => {
23742
+ const timeout = timeoutRef.current;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23743
 
23744
+ if (timeout && utils_clearTimeout) {
23745
+ utils_clearTimeout(timeout);
23746
+ }
23747
+ };
 
 
 
23748
 
23749
+ const debouncedShowMovers = event => {
23750
+ if (event) {
23751
+ event.stopPropagation();
23752
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
23753
 
23754
+ clearTimeoutRef();
 
 
 
 
 
 
 
 
 
23755
 
23756
+ if (!showMovers) {
23757
+ handleOnChange(true);
23758
+ }
23759
+ };
23760
+
23761
+ const debouncedHideMovers = event => {
23762
+ if (event) {
23763
+ event.stopPropagation();
23764
+ }
23765
+
23766
+ clearTimeoutRef();
23767
+ timeoutRef.current = utils_setTimeout(() => {
23768
+ if (shouldHideMovers()) {
23769
+ handleOnChange(false);
23770
  }
23771
+ }, debounceTimeout);
23772
+ };
23773
 
23774
+ (0,external_wp_element_namespaceObject.useEffect)(() => () => clearTimeoutRef(), []);
23775
+ return {
23776
+ showMovers,
23777
+ debouncedShowMovers,
23778
+ debouncedHideMovers
23779
+ };
 
 
 
 
 
 
 
23780
  }
23781
+ /**
23782
+ * Hook that provides a showMovers state and gesture events for DOM elements
23783
+ * that interact with the showMovers state.
23784
+ *
23785
+ * @param {Object} props Component props.
23786
+ * @param {Object} props.ref Element reference.
23787
+ * @param {number} [props.debounceTimeout=250] Debounce timeout in milliseconds.
23788
+ * @param {Function} [props.onChange=noop] Callback function.
23789
+ */
23790
 
23791
+ function useShowMoversGestures({
23792
+ ref,
23793
+ debounceTimeout = DEBOUNCE_TIMEOUT,
23794
+ onChange = external_lodash_namespaceObject.noop
23795
+ }) {
23796
+ const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
23797
+ const {
23798
+ showMovers,
23799
+ debouncedShowMovers,
23800
+ debouncedHideMovers
23801
+ } = useDebouncedShowMovers({
23802
+ ref,
23803
+ debounceTimeout,
23804
+ isFocused,
23805
+ onChange
23806
+ });
23807
+ const registerRef = (0,external_wp_element_namespaceObject.useRef)(false);
23808
 
23809
+ const isFocusedWithin = () => {
23810
+ return (ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.contains(ref.current.ownerDocument.activeElement);
23811
+ };
23812
 
23813
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
23814
+ const node = ref.current;
 
23815
 
23816
+ const handleOnFocus = () => {
23817
+ if (isFocusedWithin()) {
23818
+ setIsFocused(true);
23819
+ debouncedShowMovers();
23820
+ }
23821
+ };
23822
 
23823
+ const handleOnBlur = () => {
23824
+ if (!isFocusedWithin()) {
23825
+ setIsFocused(false);
23826
+ debouncedHideMovers();
23827
+ }
23828
+ };
23829
+ /**
23830
+ * Events are added via DOM events (vs. React synthetic events),
23831
+ * as the child React components swallow mouse events.
23832
+ */
23833
 
23834
 
23835
+ if (node && !registerRef.current) {
23836
+ node.addEventListener('focus', handleOnFocus, true);
23837
+ node.addEventListener('blur', handleOnBlur, true);
23838
+ registerRef.current = true;
 
23839
  }
 
 
 
 
 
 
 
 
 
 
23840
 
23841
+ return () => {
23842
+ if (node) {
23843
+ node.removeEventListener('focus', handleOnFocus);
23844
+ node.removeEventListener('blur', handleOnBlur);
23845
  }
23846
+ };
23847
+ }, [ref, registerRef, setIsFocused, debouncedShowMovers, debouncedHideMovers]);
23848
+ return {
23849
+ showMovers,
23850
+ gestures: {
23851
+ onMouseMove: debouncedShowMovers,
23852
+ onMouseLeave: debouncedHideMovers
23853
  }
23854
+ };
23855
  }
23856
+ //# sourceMappingURL=utils.js.map
23857
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-parent-selector/index.js
 
 
23858
 
23859
 
23860
 
23863
  */
23864
 
23865
 
23866
+
23867
+
23868
+
23869
  /**
23870
  * Internal dependencies
23871
  */
23872
 
23873
 
23874
 
 
 
 
 
 
 
 
 
 
 
 
 
23875
 
23876
 
23877
  /**
23878
+ * Block parent selector component, displaying the hierarchy of the
23879
+ * current block selection as a single icon to "go up" a level.
23880
+ *
23881
+ * @return {WPComponent} Parent block selector.
23882
  */
23883
 
23884
+ function BlockParentSelector() {
23885
+ const {
23886
+ selectBlock,
23887
+ toggleBlockHighlight
23888
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
23889
+ const {
23890
+ firstParentClientId,
23891
+ shouldHide,
23892
+ hasReducedUI
23893
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
23894
+ const {
23895
+ getBlockName,
23896
+ getBlockParents,
23897
+ getSelectedBlockClientId,
23898
+ getSettings
23899
+ } = select(store);
23900
+ const {
23901
+ hasBlockSupport
23902
+ } = select(external_wp_blocks_namespaceObject.store);
23903
+ const selectedBlockClientId = getSelectedBlockClientId();
23904
+ const parents = getBlockParents(selectedBlockClientId);
23905
+ const _firstParentClientId = parents[parents.length - 1];
23906
+ const parentBlockName = getBlockName(_firstParentClientId);
23907
+
23908
+ const _parentBlockType = (0,external_wp_blocks_namespaceObject.getBlockType)(parentBlockName);
23909
+
23910
+ const settings = getSettings();
23911
+ return {
23912
+ firstParentClientId: _firstParentClientId,
23913
+ shouldHide: !hasBlockSupport(_parentBlockType, '__experimentalParentSelector', true),
23914
+ hasReducedUI: settings.hasReducedUI
23915
+ };
23916
+ }, []);
23917
+ const blockInformation = useBlockDisplayInformation(firstParentClientId); // Allows highlighting the parent block outline when focusing or hovering
23918
+ // the parent block selector within the child.
23919
 
23920
+ const nodeRef = (0,external_wp_element_namespaceObject.useRef)();
23921
+ const {
23922
+ gestures: showMoversGestures
23923
+ } = useShowMoversGestures({
23924
+ ref: nodeRef,
23925
 
23926
+ onChange(isFocused) {
23927
+ if (isFocused && hasReducedUI) {
23928
+ return;
23929
+ }
23930
 
23931
+ toggleBlockHighlight(firstParentClientId, isFocused);
23932
+ }
23933
 
23934
+ });
 
23935
 
23936
+ if (shouldHide || firstParentClientId === undefined) {
23937
+ return null;
23938
  }
23939
 
23940
+ return (0,external_wp_element_namespaceObject.createElement)("div", _extends({
23941
+ className: "block-editor-block-parent-selector",
23942
+ key: firstParentClientId,
23943
+ ref: nodeRef
23944
+ }, showMoversGestures), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
23945
+ className: "block-editor-block-parent-selector__button",
23946
+ onClick: () => selectBlock(firstParentClientId),
23947
+ label: (0,external_wp_i18n_namespaceObject.sprintf)(
23948
+ /* translators: %s: Name of the block's parent. */
23949
+ (0,external_wp_i18n_namespaceObject.__)('Select %s'), blockInformation.title),
23950
+ showTooltip: true,
23951
+ icon: (0,external_wp_element_namespaceObject.createElement)(BlockIcon, {
23952
+ icon: blockInformation.icon
23953
+ })
23954
+ }));
23955
  }
23956
+ //# sourceMappingURL=index.js.map
23957
+ ;// CONCATENATED MODULE: ./packages/icons/build-module/library/stack.js
23958
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23959
 
23960
+ /**
23961
+ * WordPress dependencies
23962
+ */
23963
+
23964
+ const stack = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
23965
+ xmlns: "http://www.w3.org/2000/svg",
23966
+ viewBox: "0 0 24 24"
23967
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
23968
+ d: "M20.2 8v11c0 .7-.6 1.2-1.2 1.2H6v1.5h13c1.5 0 2.7-1.2 2.7-2.8V8zM18 16.4V4.6c0-.9-.7-1.6-1.6-1.6H4.6C3.7 3 3 3.7 3 4.6v11.8c0 .9.7 1.6 1.6 1.6h11.8c.9 0 1.6-.7 1.6-1.6zm-13.5 0V4.6c0-.1.1-.1.1-.1h11.8c.1 0 .1.1.1.1v11.8c0 .1-.1.1-.1.1H4.6l-.1-.1z"
23969
+ }));
23970
+ /* harmony default export */ var library_stack = (stack);
23971
+ //# sourceMappingURL=stack.js.map
23972
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-switcher/preview-block-popover.js
23973
 
23974
 
23975
  /**
23977
  */
23978
 
23979
 
23980
+ /**
23981
+ * Internal dependencies
23982
+ */
23983
+
23984
+
23985
+ function PreviewBlockPopover({
23986
+ blocks
23987
  }) {
23988
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
23989
+ className: "block-editor-block-switcher__popover__preview__parent"
23990
+ }, (0,external_wp_element_namespaceObject.createElement)("div", {
23991
+ className: "block-editor-block-switcher__popover__preview__container"
23992
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
23993
+ className: "block-editor-block-switcher__preview__popover",
23994
+ position: "bottom right",
23995
+ focusOnMount: false
23996
+ }, (0,external_wp_element_namespaceObject.createElement)("div", {
23997
+ className: "block-editor-block-switcher__preview"
23998
+ }, (0,external_wp_element_namespaceObject.createElement)("div", {
23999
+ className: "block-editor-block-switcher__preview-title"
24000
+ }, (0,external_wp_i18n_namespaceObject.__)('Preview')), (0,external_wp_element_namespaceObject.createElement)(block_preview, {
24001
+ viewportWidth: 500,
24002
+ blocks: blocks
24003
+ })))));
24004
  }
24005
+ //# sourceMappingURL=preview-block-popover.js.map
24006
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-switcher/block-transformations-menu.js
24007
+
24008
 
 
 
 
24009
  /**
24010
  * WordPress dependencies
24011
  */
24012
 
24013
 
24014
 
24015
+
24016
  /**
24017
  * Internal dependencies
24018
  */
24019
 
24020
 
 
 
 
 
 
 
 
24021
 
24022
+
24023
+ const BlockTransformationsMenu = ({
24024
+ className,
24025
+ possibleBlockTransformations,
24026
+ onSelect,
24027
+ blocks
24028
+ }) => {
24029
+ const [hoveredTransformItemName, setHoveredTransformItemName] = (0,external_wp_element_namespaceObject.useState)();
24030
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
24031
+ label: (0,external_wp_i18n_namespaceObject.__)('Transform to'),
24032
+ className: className
24033
+ }, hoveredTransformItemName && (0,external_wp_element_namespaceObject.createElement)(PreviewBlockPopover, {
24034
+ blocks: (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, hoveredTransformItemName)
24035
+ }), possibleBlockTransformations.map(item => {
24036
  const {
24037
+ name,
24038
+ icon,
24039
+ title,
24040
+ isDisabled
24041
+ } = item;
24042
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
24043
+ key: name,
24044
+ className: (0,external_wp_blocks_namespaceObject.getBlockMenuDefaultClassName)(name),
24045
+ onClick: event => {
24046
+ event.preventDefault();
24047
+ onSelect(name);
24048
+ },
24049
+ disabled: isDisabled,
24050
+ onMouseLeave: () => setHoveredTransformItemName(null),
24051
+ onMouseEnter: () => setHoveredTransformItemName(name)
24052
+ }, (0,external_wp_element_namespaceObject.createElement)(BlockIcon, {
24053
+ icon: icon,
24054
+ showColors: true
24055
+ }), title);
24056
+ }));
24057
  };
24058
 
24059
+ /* harmony default export */ var block_transformations_menu = (BlockTransformationsMenu);
24060
+ //# sourceMappingURL=block-transformations-menu.js.map
24061
+ ;// CONCATENATED MODULE: external ["wp","tokenList"]
24062
+ var external_wp_tokenList_namespaceObject = window["wp"]["tokenList"];
24063
+ var external_wp_tokenList_default = /*#__PURE__*/__webpack_require__.n(external_wp_tokenList_namespaceObject);
24064
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-styles/utils.js
24065
+ /**
24066
+ * External dependencies
24067
+ */
24068
 
24069
  /**
24070
  * WordPress dependencies
24071
  */
24072
 
24073
+
24074
  /**
24075
+ * Returns the active style from the given className.
24076
+ *
24077
+ * @param {Array} styles Block style variations.
24078
+ * @param {string} className Class name
24079
+ *
24080
+ * @return {Object?} The active style.
24081
  */
24082
 
24083
+ function getActiveStyle(styles, className) {
24084
+ for (const style of new (external_wp_tokenList_default())(className).values()) {
24085
+ if (style.indexOf('is-style-') === -1) {
24086
+ continue;
24087
+ }
24088
 
24089
+ const potentialStyleName = style.substring(9);
24090
+ const activeStyle = (0,external_lodash_namespaceObject.find)(styles, {
24091
+ name: potentialStyleName
24092
+ });
24093
 
24094
+ if (activeStyle) {
24095
+ return activeStyle;
24096
+ }
24097
+ }
24098
 
24099
+ return (0,external_lodash_namespaceObject.find)(styles, 'isDefault');
24100
+ }
24101
+ /**
24102
+ * Replaces the active style in the block's className.
24103
+ *
24104
+ * @param {string} className Class name.
24105
+ * @param {Object?} activeStyle The replaced style.
24106
+ * @param {Object} newStyle The replacing style.
24107
+ *
24108
+ * @return {string} The updated className.
24109
+ */
24110
 
24111
+ function replaceActiveStyle(className, activeStyle, newStyle) {
24112
+ const list = new (external_wp_tokenList_default())(className);
24113
 
24114
+ if (activeStyle) {
24115
+ list.remove('is-style-' + activeStyle.name);
24116
+ }
 
 
 
 
 
 
 
 
24117
 
24118
+ list.add('is-style-' + newStyle.name);
24119
+ return list.value;
24120
+ }
24121
+ //# sourceMappingURL=utils.js.map
24122
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-styles/index.js
24123
 
24124
 
24125
  /**
24126
  * External dependencies
24127
  */
24128
 
24129
+
24130
  /**
24131
  * WordPress dependencies
24132
  */
24134
 
24135
 
24136
 
24137
+
24138
+
24139
  /**
24140
  * Internal dependencies
24141
  */
24143
 
24144
 
24145
 
24146
+ const EMPTY_OBJECT = {};
24147
 
24148
+ function useGenericPreviewBlock(block, type) {
24149
+ return (0,external_wp_element_namespaceObject.useMemo)(() => {
24150
+ const example = type === null || type === void 0 ? void 0 : type.example;
24151
+ const blockName = type === null || type === void 0 ? void 0 : type.name;
24152
 
24153
+ if (example && blockName) {
24154
+ return (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockName, {
24155
+ attributes: example.attributes,
24156
+ innerBlocks: example.innerBlocks
24157
+ });
24158
+ }
24159
 
24160
+ if (block) {
24161
+ return (0,external_wp_blocks_namespaceObject.cloneBlock)(block);
24162
+ }
24163
+ }, [type !== null && type !== void 0 && type.example ? block === null || block === void 0 ? void 0 : block.name : block, type]);
24164
+ }
 
 
24165
 
24166
+ function BlockStyles({
24167
+ clientId,
24168
+ onSwitch = external_lodash_namespaceObject.noop,
24169
+ onHoverClassName = external_lodash_namespaceObject.noop,
24170
+ itemRole
 
24171
  }) {
24172
+ const selector = select => {
24173
+ const {
24174
+ getBlock
24175
+ } = select(store);
24176
+ const block = getBlock(clientId);
24177
+
24178
+ if (!block) {
24179
+ return EMPTY_OBJECT;
24180
+ }
24181
+
24182
+ const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name);
24183
+ const {
24184
+ getBlockStyles
24185
+ } = select(external_wp_blocks_namespaceObject.store);
24186
+ return {
24187
+ block,
24188
+ type: blockType,
24189
+ styles: getBlockStyles(block.name),
24190
+ className: block.attributes.className || ''
24191
  };
24192
+ };
 
24193
 
24194
+ const {
24195
+ styles,
24196
+ block,
24197
+ type,
24198
+ className
24199
+ } = (0,external_wp_data_namespaceObject.useSelect)(selector, [clientId]);
24200
+ const {
24201
+ updateBlockAttributes
24202
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
24203
+ const genericPreviewBlock = useGenericPreviewBlock(block, type);
24204
+
24205
+ if (!styles || styles.length === 0) {
24206
+ return null;
24207
+ }
24208
+
24209
+ const renderedStyles = (0,external_lodash_namespaceObject.find)(styles, 'isDefault') ? styles : [{
24210
+ name: 'default',
24211
+ label: (0,external_wp_i18n_namespaceObject._x)('Default', 'block style'),
24212
+ isDefault: true
24213
+ }, ...styles];
24214
+ const activeStyle = getActiveStyle(renderedStyles, className);
24215
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
24216
+ className: "block-editor-block-styles"
24217
+ }, renderedStyles.map(style => {
24218
+ var _type$example$viewpor, _type$example;
24219
+
24220
+ const styleClassName = replaceActiveStyle(className, activeStyle, style);
24221
+ return (0,external_wp_element_namespaceObject.createElement)(BlockStyleItem, {
24222
+ genericPreviewBlock: genericPreviewBlock,
24223
+ viewportWidth: (_type$example$viewpor = (_type$example = type.example) === null || _type$example === void 0 ? void 0 : _type$example.viewportWidth) !== null && _type$example$viewpor !== void 0 ? _type$example$viewpor : 500,
24224
+ className: className,
24225
+ isActive: activeStyle === style,
24226
+ key: style.name,
24227
+ onSelect: () => {
24228
+ updateBlockAttributes(clientId, {
24229
+ className: styleClassName
24230
+ });
24231
+ onHoverClassName(null);
24232
+ onSwitch();
24233
+ },
24234
+ onBlur: () => onHoverClassName(null),
24235
+ onHover: () => onHoverClassName(styleClassName),
24236
+ style: style,
24237
+ styleClassName: styleClassName,
24238
+ itemRole: itemRole
24239
  });
24240
+ }));
24241
+ }
24242
 
24243
+ function BlockStyleItem({
24244
+ genericPreviewBlock,
24245
+ viewportWidth,
24246
+ style,
24247
+ isActive,
24248
+ onBlur,
24249
+ onHover,
24250
+ onSelect,
24251
+ styleClassName,
24252
+ itemRole
24253
+ }) {
24254
+ const previewBlocks = (0,external_wp_element_namespaceObject.useMemo)(() => {
24255
+ return { ...genericPreviewBlock,
24256
+ attributes: { ...genericPreviewBlock.attributes,
24257
+ className: styleClassName
24258
+ }
24259
+ };
24260
+ }, [genericPreviewBlock, styleClassName]);
24261
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
24262
+ key: style.name,
24263
+ className: classnames_default()('block-editor-block-styles__item', {
24264
+ 'is-active': isActive
24265
+ }),
24266
+ onClick: () => onSelect(),
24267
+ onKeyDown: event => {
24268
+ if (external_wp_keycodes_namespaceObject.ENTER === event.keyCode || external_wp_keycodes_namespaceObject.SPACE === event.keyCode) {
24269
+ event.preventDefault();
24270
+ onSelect();
24271
+ }
24272
+ },
24273
+ onMouseEnter: onHover,
24274
+ onMouseLeave: onBlur,
24275
+ role: itemRole || 'button',
24276
+ tabIndex: "0",
24277
+ "aria-label": style.label || style.name
24278
+ }, (0,external_wp_element_namespaceObject.createElement)("div", {
24279
+ className: "block-editor-block-styles__item-preview"
24280
+ }, (0,external_wp_element_namespaceObject.createElement)(block_preview, {
24281
+ viewportWidth: viewportWidth,
24282
+ blocks: previewBlocks
24283
+ })), (0,external_wp_element_namespaceObject.createElement)("div", {
24284
+ className: "block-editor-block-styles__item-label"
24285
+ }, style.label || style.name));
24286
+ }
24287
 
24288
+ /* harmony default export */ var block_styles = (BlockStyles);
24289
+ //# sourceMappingURL=index.js.map
24290
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-switcher/block-styles-menu.js
24291
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24292
 
24293
+ /**
24294
+ * WordPress dependencies
24295
+ */
24296
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24297
 
 
 
 
24298
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24299
 
24300
 
24301
  /**
24302
+ * Internal dependencies
24303
  */
24304
 
24305
+
24306
+
24307
+ function BlockStylesMenu({
24308
+ hoveredBlock,
24309
+ onSwitch
24310
+ }) {
24311
+ const {
24312
+ name,
24313
+ clientId
24314
+ } = hoveredBlock;
24315
+ const [hoveredClassName, setHoveredClassName] = (0,external_wp_element_namespaceObject.useState)();
24316
+ const blockType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).getBlockType(name), [name]);
24317
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
24318
+ label: (0,external_wp_i18n_namespaceObject.__)('Styles'),
24319
+ className: "block-editor-block-switcher__styles__menugroup"
24320
+ }, hoveredClassName && (0,external_wp_element_namespaceObject.createElement)(PreviewBlockPopover, {
24321
+ blocks: blockType && blockType.example ? (0,external_wp_blocks_namespaceObject.getBlockFromExample)(blockType.name, {
24322
+ attributes: { ...blockType.example.attributes,
24323
+ className: hoveredClassName
24324
+ },
24325
+ innerBlocks: blockType.example.innerBlocks
24326
+ }) : (0,external_wp_blocks_namespaceObject.cloneBlock)(hoveredBlock, {
24327
+ className: hoveredClassName
24328
+ })
24329
+ }), (0,external_wp_element_namespaceObject.createElement)(block_styles, {
24330
+ clientId: clientId,
24331
+ onSwitch: onSwitch,
24332
+ onHoverClassName: setHoveredClassName,
24333
+ itemRole: "menuitem"
24334
+ }));
24335
+ }
24336
+ //# sourceMappingURL=block-styles-menu.js.map
24337
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-switcher/utils.js
24338
  /**
24339
  * WordPress dependencies
24340
  */
24341
 
24342
+ /**
24343
+ * Try to find a matching block by a block's name in a provided
24344
+ * block. We recurse through InnerBlocks and return the reference
24345
+ * of the matched block (it could be an InnerBlock).
24346
+ * If no match is found return nothing.
24347
+ *
24348
+ * @param {WPBlock} block The block to try to find a match.
24349
+ * @param {string} selectedBlockName The block's name to use for matching condition.
24350
+ * @param {Set} consumedBlocks A set holding the previously matched/consumed blocks.
24351
+ *
24352
+ * @return {WPBlock?} The matched block if found or nothing(`undefined`).
24353
+ */
24354
 
24355
+ const getMatchingBlockByName = (block, selectedBlockName, consumedBlocks = new Set()) => {
24356
+ const {
24357
+ clientId,
24358
+ name,
24359
+ innerBlocks = []
24360
+ } = block; // Check if block has been consumed already.
24361
 
24362
+ if (consumedBlocks.has(clientId)) return;
24363
+ if (name === selectedBlockName) return block; // Try to find a matching block from InnerBlocks recursively.
24364
 
24365
+ for (const innerBlock of innerBlocks) {
24366
+ const match = getMatchingBlockByName(innerBlock, selectedBlockName, consumedBlocks);
24367
+ if (match) return match;
24368
+ }
24369
+ };
24370
+ /**
24371
+ * Find and return the block attributes to retain through
24372
+ * the transformation, based on Block Type's `role:content`
24373
+ * attributes. If no `role:content` attributes exist,
24374
+ * return selected block's attributes.
24375
+ *
24376
+ * @param {string} name Block type's namespaced name.
24377
+ * @param {Object} attributes Selected block's attributes.
24378
+ * @return {Object} The block's attributes to retain.
24379
+ */
 
 
 
 
 
24380
 
24381
+ const getRetainedBlockAttributes = (name, attributes) => {
24382
+ const contentAttributes = (0,external_wp_blocks_namespaceObject.__experimentalGetBlockAttributesNamesByRole)(name, 'content');
24383
+ if (!(contentAttributes !== null && contentAttributes !== void 0 && contentAttributes.length)) return attributes;
24384
+ return contentAttributes.reduce((_accumulator, attribute) => {
24385
+ if (attributes[attribute]) _accumulator[attribute] = attributes[attribute];
24386
+ return _accumulator;
24387
+ }, {});
24388
+ };
24389
+ //# sourceMappingURL=utils.js.map
24390
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-switcher/use-transformed-patterns.js
24391
+ /**
24392
+ * WordPress dependencies
24393
+ */
24394
 
24395
 
24396
+ /**
24397
+ * Internal dependencies
24398
+ */
 
 
24399
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24400
 
 
 
 
 
 
24401
  /**
24402
+ * Mutate the matched block's attributes by getting
24403
+ * which block type's attributes to retain and prioritize
24404
+ * them in the merging of the attributes.
24405
+ *
24406
+ * @param {WPBlock} match The matched block.
24407
+ * @param {WPBlock} selectedBlock The selected block.
24408
+ * @return {void}
24409
  */
24410
 
24411
+ const transformMatchingBlock = (match, selectedBlock) => {
24412
+ // Get the block attributes to retain through the transformation.
24413
+ const retainedBlockAttributes = getRetainedBlockAttributes(selectedBlock.name, selectedBlock.attributes);
24414
+ match.attributes = { ...match.attributes,
24415
+ ...retainedBlockAttributes
24416
+ };
24417
+ };
24418
  /**
24419
+ * By providing the selected blocks and pattern's blocks
24420
+ * find the matching blocks, transform them and return them.
24421
+ * If not all selected blocks are matched, return nothing.
24422
+ *
24423
+ * @param {WPBlock[]} selectedBlocks The selected blocks.
24424
+ * @param {WPBlock[]} patternBlocks The pattern's blocks.
24425
+ * @return {WPBlock[]|void} The transformed pattern's blocks or undefined if not all selected blocks have been matched.
24426
  */
24427
 
24428
+ const getPatternTransformedBlocks = (selectedBlocks, patternBlocks) => {
24429
+ // Clone Pattern's blocks to produce new clientIds and be able to mutate the matches.
24430
+ const _patternBlocks = patternBlocks.map(block => (0,external_wp_blocks_namespaceObject.cloneBlock)(block));
24431
+ /**
24432
+ * Keep track of the consumed pattern blocks.
24433
+ * This is needed because we loop the selected blocks
24434
+ * and for example we may have selected two paragraphs and
24435
+ * the pattern's blocks could have more `paragraphs`.
24436
+ */
24437
+
24438
+
24439
+ const consumedBlocks = new Set();
24440
+
24441
+ for (const selectedBlock of selectedBlocks) {
24442
+ let isMatch = false;
24443
+
24444
+ for (const patternBlock of _patternBlocks) {
24445
+ const match = getMatchingBlockByName(patternBlock, selectedBlock.name, consumedBlocks);
24446
+ if (!match) continue;
24447
+ isMatch = true;
24448
+ consumedBlocks.add(match.clientId); // We update (mutate) the matching pattern block.
24449
+
24450
+ transformMatchingBlock(match, selectedBlock); // No need to loop through other pattern's blocks.
24451
 
24452
+ break;
24453
+ } // Bail eary if a selected block has not been matched.
24454
 
24455
 
24456
+ if (!isMatch) return;
24457
+ }
24458
 
24459
+ return _patternBlocks;
24460
+ };
24461
+ /**
24462
+ * @typedef {WPBlockPattern & {transformedBlocks: WPBlock[]}} TransformedBlockPattern
24463
+ */
24464
 
24465
  /**
24466
+ * Custom hook that accepts patterns from state and the selected
24467
+ * blocks and tries to match these with the pattern's blocks.
24468
+ * If all selected blocks are matched with a Pattern's block,
24469
+ * we transform them by retaining block's attributes with `role:content`.
24470
+ * The transformed pattern's blocks are set to a new pattern
24471
+ * property `transformedBlocks`.
24472
+ *
24473
+ * @param {WPBlockPattern[]} patterns Patterns from state.
24474
+ * @param {WPBlock[]} selectedBlocks The currently selected blocks.
24475
+ * @return {TransformedBlockPattern[]} Returns the eligible matched patterns with all the selected blocks.
24476
  */
24477
+ // TODO tests
24478
 
24479
+ const useTransformedPatterns = (patterns, selectedBlocks) => {
24480
+ return (0,external_wp_element_namespaceObject.useMemo)(() => patterns.reduce((accumulator, _pattern) => {
24481
+ const transformedBlocks = getPatternTransformedBlocks(selectedBlocks, _pattern.blocks);
24482
 
24483
+ if (transformedBlocks) {
24484
+ accumulator.push({ ..._pattern,
24485
+ transformedBlocks
24486
+ });
24487
+ }
 
 
 
24488
 
24489
+ return accumulator;
24490
+ }, []), [patterns, selectedBlocks]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24491
  };
24492
 
24493
+ /* harmony default export */ var use_transformed_patterns = (useTransformedPatterns);
24494
+ //# sourceMappingURL=use-transformed-patterns.js.map
24495
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-switcher/pattern-transformations-menu.js
24496
 
24497
 
24498
 
24503
 
24504
 
24505
 
24506
+
24507
  /**
24508
  * Internal dependencies
24509
  */
24511
 
24512
 
24513
 
24514
+ function PatternTransformationsMenu({
24515
+ blocks,
24516
+ patterns: statePatterns,
24517
+ onSelect
24518
+ }) {
24519
+ const [showTransforms, setShowTransforms] = (0,external_wp_element_namespaceObject.useState)(false);
24520
+ const patterns = use_transformed_patterns(statePatterns, blocks);
24521
+ if (!patterns.length) return null;
24522
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
24523
+ className: "block-editor-block-switcher__pattern__transforms__menugroup"
24524
+ }, showTransforms && (0,external_wp_element_namespaceObject.createElement)(PreviewPatternsPopover, {
24525
+ patterns: patterns,
24526
+ onSelect: onSelect
24527
+ }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
24528
+ onClick: event => {
24529
+ event.preventDefault();
24530
+ setShowTransforms(!showTransforms);
24531
+ },
24532
+ icon: chevron_right
24533
+ }, (0,external_wp_i18n_namespaceObject.__)('Patterns')));
24534
+ }
24535
+
24536
+ function PreviewPatternsPopover({
24537
+ patterns,
24538
+ onSelect
24539
+ }) {
24540
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
24541
+ className: "block-editor-block-switcher__popover__preview__parent"
24542
+ }, (0,external_wp_element_namespaceObject.createElement)("div", {
24543
+ className: "block-editor-block-switcher__popover__preview__container"
24544
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
24545
+ className: "block-editor-block-switcher__preview__popover",
24546
+ position: "bottom right"
24547
+ }, (0,external_wp_element_namespaceObject.createElement)("div", {
24548
+ className: "block-editor-block-switcher__preview"
24549
+ }, (0,external_wp_element_namespaceObject.createElement)("div", {
24550
+ className: "block-editor-block-switcher__preview-title"
24551
+ }, (0,external_wp_i18n_namespaceObject.__)('Preview')), (0,external_wp_element_namespaceObject.createElement)(BlockPatternsList, {
24552
+ patterns: patterns,
24553
+ onSelect: onSelect
24554
+ })))));
24555
+ }
24556
+
24557
+ function BlockPatternsList({
24558
+ patterns,
24559
+ onSelect
24560
+ }) {
24561
+ const composite = (0,external_wp_components_namespaceObject.__unstableUseCompositeState)();
24562
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableComposite, _extends({}, composite, {
24563
+ role: "listbox",
24564
+ className: "block-editor-block-switcher__preview-patterns-container",
24565
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Patterns list')
24566
+ }), patterns.map(pattern => (0,external_wp_element_namespaceObject.createElement)(pattern_transformations_menu_BlockPattern, {
24567
+ key: pattern.name,
24568
+ pattern: pattern,
24569
+ onSelect: onSelect,
24570
+ composite: composite
24571
+ })));
24572
+ }
24573
 
24574
+ function pattern_transformations_menu_BlockPattern({
 
24575
  pattern,
24576
+ onSelect,
24577
  composite
24578
  }) {
24579
+ // TODO check pattern/preview width...
24580
+ const baseClassName = 'block-editor-block-switcher__preview-patterns-container';
24581
+ const descriptionId = (0,external_wp_compose_namespaceObject.useInstanceId)(pattern_transformations_menu_BlockPattern, `${baseClassName}-list__item-description`);
24582
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
24583
+ className: `${baseClassName}-list__list-item`,
 
 
 
 
 
 
 
 
 
 
 
 
 
24584
  "aria-label": pattern.title,
24585
+ "aria-describedby": pattern.description ? descriptionId : undefined
 
 
 
24586
  }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableCompositeItem, _extends({
24587
  role: "option",
24588
  as: "div"
24589
  }, composite, {
24590
+ className: `${baseClassName}-list__item`,
24591
+ onClick: () => onSelect(pattern.transformedBlocks)
24592
  }), (0,external_wp_element_namespaceObject.createElement)(block_preview, {
24593
+ blocks: pattern.transformedBlocks,
24594
+ viewportWidth: pattern.viewportWidth || 500
24595
  }), (0,external_wp_element_namespaceObject.createElement)("div", {
24596
+ className: `${baseClassName}-list__item-title`
24597
+ }, pattern.title)), !!pattern.description && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
24598
  id: descriptionId
24599
+ }, pattern.description));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24600
  }
24601
 
24602
+ /* harmony default export */ var pattern_transformations_menu = (PatternTransformationsMenu);
24603
+ //# sourceMappingURL=pattern-transformations-menu.js.map
24604
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-switcher/index.js
24605
 
24606
 
24607
  /**
24615
 
24616
 
24617
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24618
 
24619
 
24620
  /**
24621
+ * Internal dependencies
24622
  */
24623
 
24624
 
24625
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24626
 
 
 
 
24627
 
24628
 
24629
 
 
 
 
24630
 
24631
+ const BlockSwitcherDropdownMenu = ({
24632
+ clientIds,
24633
+ blocks
24634
+ }) => {
24635
+ const {
24636
+ replaceBlocks
24637
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
24638
+ const blockInformation = useBlockDisplayInformation(blocks[0].clientId);
24639
+ const {
24640
+ possibleBlockTransformations,
24641
+ canRemove,
24642
+ hasBlockStyles,
24643
+ icon,
24644
+ blockTitle,
24645
+ patterns
24646
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
24647
+ var _getBlockType2;
24648
 
24649
+ const {
24650
+ getBlockRootClientId,
24651
+ getBlockTransformItems,
24652
+ __experimentalGetPatternTransformItems
24653
+ } = select(store);
24654
+ const {
24655
+ getBlockStyles,
24656
+ getBlockType
24657
+ } = select(external_wp_blocks_namespaceObject.store);
24658
+ const {
24659
+ canRemoveBlocks
24660
+ } = select(store);
24661
+ const rootClientId = getBlockRootClientId((0,external_lodash_namespaceObject.castArray)(clientIds)[0]);
24662
+ const [{
24663
+ name: firstBlockName
24664
+ }] = blocks;
24665
 
24666
+ const _isSingleBlockSelected = blocks.length === 1;
24667
 
24668
+ const styles = _isSingleBlockSelected && getBlockStyles(firstBlockName);
24669
 
24670
+ let _icon;
24671
 
24672
+ if (_isSingleBlockSelected) {
24673
+ _icon = blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon; // Take into account active block variations.
24674
+ } else {
24675
+ var _getBlockType;
 
 
 
 
 
 
 
24676
 
24677
+ const isSelectionOfSameType = (0,external_lodash_namespaceObject.uniq)(blocks.map(({
24678
+ name
24679
+ }) => name)).length === 1; // When selection consists of blocks of multiple types, display an
24680
+ // appropriate icon to communicate the non-uniformity.
24681
 
24682
+ _icon = isSelectionOfSameType ? (_getBlockType = getBlockType(firstBlockName)) === null || _getBlockType === void 0 ? void 0 : _getBlockType.icon : library_stack;
24683
+ }
 
 
 
 
 
 
 
24684
 
24685
+ return {
24686
+ possibleBlockTransformations: getBlockTransformItems(blocks, rootClientId),
24687
+ canRemove: canRemoveBlocks(clientIds, rootClientId),
24688
+ hasBlockStyles: !!(styles !== null && styles !== void 0 && styles.length),
24689
+ icon: _icon,
24690
+ blockTitle: (_getBlockType2 = getBlockType(firstBlockName)) === null || _getBlockType2 === void 0 ? void 0 : _getBlockType2.title,
24691
+ patterns: __experimentalGetPatternTransformItems(blocks, rootClientId)
24692
+ };
24693
+ }, [clientIds, blocks, blockInformation === null || blockInformation === void 0 ? void 0 : blockInformation.icon]);
24694
+ const isReusable = blocks.length === 1 && (0,external_wp_blocks_namespaceObject.isReusableBlock)(blocks[0]);
24695
+ const isTemplate = blocks.length === 1 && (0,external_wp_blocks_namespaceObject.isTemplatePart)(blocks[0]); // Simple block tranformation based on the `Block Transforms` API.
24696
 
24697
+ const onBlockTransform = name => replaceBlocks(clientIds, (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, name)); // Pattern transformation through the `Patterns` API.
24698
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24699
 
24700
+ const onPatternTransform = transformedBlocks => replaceBlocks(clientIds, transformedBlocks);
 
 
 
 
 
 
 
 
 
 
24701
 
24702
+ const hasPossibleBlockTransformations = !!possibleBlockTransformations.length && canRemove;
24703
+ const hasPatternTransformation = !!(patterns !== null && patterns !== void 0 && patterns.length) && canRemove;
 
24704
 
24705
+ if (!hasBlockStyles && !hasPossibleBlockTransformations) {
24706
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
24707
+ disabled: true,
24708
+ className: "block-editor-block-switcher__no-switcher-icon",
24709
+ title: blockTitle,
24710
+ icon: (0,external_wp_element_namespaceObject.createElement)(BlockIcon, {
24711
+ icon: icon,
24712
+ showColors: true
24713
+ })
24714
+ }));
24715
+ }
24716
 
24717
+ const blockSwitcherLabel = blockTitle;
24718
+ const blockSwitcherDescription = 1 === blocks.length ? (0,external_wp_i18n_namespaceObject.sprintf)(
24719
+ /* translators: %s: block title. */
24720
+ (0,external_wp_i18n_namespaceObject.__)('%s: Change block type or style'), blockTitle) : (0,external_wp_i18n_namespaceObject.sprintf)(
24721
+ /* translators: %d: number of blocks. */
24722
+ (0,external_wp_i18n_namespaceObject._n)('Change type of %d block', 'Change type of %d blocks', blocks.length), blocks.length);
24723
+ const showDropDown = hasBlockStyles || hasPossibleBlockTransformations || hasPatternTransformation;
24724
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, null, toggleProps => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
24725
+ className: "block-editor-block-switcher",
24726
+ label: blockSwitcherLabel,
24727
+ popoverProps: {
24728
+ position: 'bottom right',
24729
+ isAlternate: true,
24730
+ className: 'block-editor-block-switcher__popover'
24731
+ },
24732
+ icon: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(BlockIcon, {
24733
+ icon: icon,
24734
+ className: "block-editor-block-switcher__toggle",
24735
+ showColors: true
24736
+ }), (isReusable || isTemplate) && (0,external_wp_element_namespaceObject.createElement)("span", {
24737
+ className: "block-editor-block-switcher__toggle-text"
24738
+ }, (0,external_wp_element_namespaceObject.createElement)(BlockTitle, {
24739
+ clientId: clientIds
24740
+ }))),
24741
+ toggleProps: {
24742
+ describedBy: blockSwitcherDescription,
24743
+ ...toggleProps
24744
+ },
24745
+ menuProps: {
24746
+ orientation: 'both'
24747
+ }
24748
+ }, ({
24749
+ onClose
24750
+ }) => showDropDown && (0,external_wp_element_namespaceObject.createElement)("div", {
24751
+ className: "block-editor-block-switcher__container"
24752
+ }, hasPatternTransformation && (0,external_wp_element_namespaceObject.createElement)(pattern_transformations_menu, {
24753
+ blocks: blocks,
24754
+ patterns: patterns,
24755
+ onSelect: transformedBlocks => {
24756
+ onPatternTransform(transformedBlocks);
24757
+ onClose();
24758
+ }
24759
+ }), hasPossibleBlockTransformations && (0,external_wp_element_namespaceObject.createElement)(block_transformations_menu, {
24760
+ className: "block-editor-block-switcher__transforms__menugroup",
24761
+ possibleBlockTransformations: possibleBlockTransformations,
24762
+ blocks: blocks,
24763
+ onSelect: name => {
24764
+ onBlockTransform(name);
24765
+ onClose();
24766
+ }
24767
+ }), hasBlockStyles && (0,external_wp_element_namespaceObject.createElement)(BlockStylesMenu, {
24768
+ hoveredBlock: blocks[0],
24769
+ onSwitch: onClose
24770
+ })))));
24771
+ };
24772
+ const BlockSwitcher = ({
24773
+ clientIds
24774
+ }) => {
24775
+ const blocks = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getBlocksByClientId(clientIds), [clientIds]);
24776
 
24777
+ if (!blocks.length || blocks.some(block => !block)) {
24778
+ return null;
24779
+ }
24780
 
24781
+ return (0,external_wp_element_namespaceObject.createElement)(BlockSwitcherDropdownMenu, {
24782
+ clientIds: clientIds,
24783
+ blocks: blocks
24784
+ });
24785
+ };
24786
+ /* harmony default export */ var block_switcher = (BlockSwitcher);
24787
+ //# sourceMappingURL=index.js.map
24788
+ ;// CONCATENATED MODULE: ./packages/icons/build-module/library/more-vertical.js
24789
 
24790
 
24791
  /**
24792
+ * WordPress dependencies
24793
  */
24794
 
24795
+ const moreVertical = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
24796
+ xmlns: "http://www.w3.org/2000/svg",
24797
+ viewBox: "0 0 24 24"
24798
+ }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
24799
+ d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
24800
+ }));
24801
+ /* harmony default export */ var more_vertical = (moreVertical);
24802
+ //# sourceMappingURL=more-vertical.js.map
24803
+ ;// CONCATENATED MODULE: external ["wp","blob"]
24804
+ var external_wp_blob_namespaceObject = window["wp"]["blob"];
24805
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/utils/get-paste-event-data.js
24806
  /**
24807
+ * WordPress dependencies
 
 
 
 
 
 
 
 
 
 
24808
  */
24809
 
 
 
 
 
 
 
24810
 
24811
+ function getPasteEventData({
24812
+ clipboardData
 
 
 
 
 
24813
  }) {
24814
+ let plainText = '';
24815
+ let html = ''; // IE11 only supports `Text` as an argument for `getData` and will
24816
+ // otherwise throw an invalid argument error, so we try the standard
24817
+ // arguments first, then fallback to `Text` if they fail.
 
 
 
 
 
 
 
 
 
 
 
 
 
24818
 
24819
+ try {
24820
+ plainText = clipboardData.getData('text/plain');
24821
+ html = clipboardData.getData('text/html');
24822
+ } catch (error1) {
24823
+ try {
24824
+ html = clipboardData.getData('Text');
24825
+ } catch (error2) {
24826
+ // Some browsers like UC Browser paste plain text by default and
24827
+ // don't support clipboardData at all, so allow default
24828
+ // behaviour.
24829
+ return;
 
24830
  }
24831
+ }
24832
 
24833
+ const files = (0,external_wp_dom_namespaceObject.getFilesFromDataTransfer)(clipboardData).filter(({
24834
+ type
24835
+ }) => /^image\/(?:jpe?g|png|gif)$/.test(type)); // Only process files if no HTML is present.
24836
+ // A pasted file may have the URL as plain text.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24837
 
24838
+ if (files.length && !html) {
24839
+ html = files.map(file => `<img src="${(0,external_wp_blob_namespaceObject.createBlobURL)(file)}">`).join('');
24840
+ plainText = '';
24841
+ }
24842
 
24843
+ return {
24844
+ html,
24845
+ plainText
24846
+ };
 
 
 
 
 
 
 
 
24847
  }
24848
+ //# sourceMappingURL=get-paste-event-data.js.map
24849
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/copy-handler/index.js
24850
+
24851
 
 
 
 
24852
  /**
24853
+ * WordPress dependencies
24854
  */
 
24855
 
 
24856
 
 
24857
 
 
24858
 
 
24859
 
 
24860
 
24861
+
24862
  /**
24863
+ * Internal dependencies
 
 
 
 
24864
  */
24865
 
24866
 
 
 
 
 
 
 
 
 
24867
 
24868
+ function useNotifyCopy() {
24869
+ const {
24870
+ getBlockName
24871
+ } = (0,external_wp_data_namespaceObject.useSelect)(store);
24872
+ const {
24873
+ getBlockType
24874
+ } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store);
24875
+ const {
24876
+ createSuccessNotice
24877
+ } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
24878
+ return (0,external_wp_element_namespaceObject.useCallback)((eventType, selectedBlockClientIds) => {
24879
+ let notice = '';
24880
 
24881
+ if (selectedBlockClientIds.length === 1) {
24882
+ var _getBlockType;
24883
 
24884
+ const clientId = selectedBlockClientIds[0];
24885
+ const title = (_getBlockType = getBlockType(getBlockName(clientId))) === null || _getBlockType === void 0 ? void 0 : _getBlockType.title;
24886
+ notice = eventType === 'copy' ? (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: Name of the block being copied, e.g. "Paragraph".
24887
+ (0,external_wp_i18n_namespaceObject.__)('Copied "%s" to clipboard.'), title) : (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: Name of the block being cut, e.g. "Paragraph".
24888
+ (0,external_wp_i18n_namespaceObject.__)('Moved "%s" to clipboard.'), title);
24889
+ } else {
24890
+ notice = eventType === 'copy' ? (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %d: Number of blocks being copied.
24891
+ (0,external_wp_i18n_namespaceObject._n)('Copied %d block to clipboard.', 'Copied %d blocks to clipboard.', selectedBlockClientIds.length), selectedBlockClientIds.length) : (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %d: Number of blocks being cut.
24892
+ (0,external_wp_i18n_namespaceObject._n)('Moved %d block to clipboard.', 'Moved %d blocks to clipboard.', selectedBlockClientIds.length), selectedBlockClientIds.length);
24893
+ }
24894
 
24895
+ createSuccessNotice(notice, {
24896
+ type: 'snackbar'
24897
+ });
24898
+ }, []);
24899
+ }
24900
+ function useClipboardHandler() {
24901
+ const {
24902
+ getBlocksByClientId,
24903
+ getSelectedBlockClientIds,
24904
+ hasMultiSelection,
24905
+ getSettings
24906
+ } = (0,external_wp_data_namespaceObject.useSelect)(store);
24907
+ const {
24908
+ flashBlock,
24909
+ removeBlocks,
24910
+ replaceBlocks
24911
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
24912
+ const notifyCopy = useNotifyCopy();
24913
+ return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
24914
+ function handler(event) {
24915
+ const selectedBlockClientIds = getSelectedBlockClientIds();
24916
 
24917
+ if (selectedBlockClientIds.length === 0) {
24918
+ return;
24919
+ } // Always handle multiple selected blocks.
24920
 
 
 
 
24921
 
24922
+ if (!hasMultiSelection()) {
24923
+ const {
24924
+ target
24925
+ } = event;
24926
+ const {
24927
+ ownerDocument
24928
+ } = target; // If copying, only consider actual text selection as selection.
24929
+ // Otherwise, any focus on an input field is considered.
24930
 
24931
+ const hasSelection = event.type === 'copy' || event.type === 'cut' ? (0,external_wp_dom_namespaceObject.documentHasUncollapsedSelection)(ownerDocument) : (0,external_wp_dom_namespaceObject.documentHasSelection)(ownerDocument); // Let native copy behaviour take over in input fields.
 
 
 
 
 
24932
 
24933
+ if (hasSelection) {
24934
+ return;
24935
+ }
24936
+ }
 
 
 
 
 
 
 
 
 
 
24937
 
24938
+ if (!node.contains(event.target.ownerDocument.activeElement)) {
24939
+ return;
24940
+ }
24941
 
24942
+ const eventDefaultPrevented = event.defaultPrevented;
24943
+ event.preventDefault();
 
24944
 
24945
+ if (event.type === 'copy' || event.type === 'cut') {
24946
+ if (selectedBlockClientIds.length === 1) {
24947
+ flashBlock(selectedBlockClientIds[0]);
24948
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
24949
 
24950
+ notifyCopy(event.type, selectedBlockClientIds);
24951
+ const blocks = getBlocksByClientId(selectedBlockClientIds);
24952
+ const serialized = (0,external_wp_blocks_namespaceObject.serialize)(blocks);
24953
+ event.clipboardData.setData('text/plain', serialized);
24954
+ event.clipboardData.setData('text/html', serialized);
24955
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24956
 
24957
+ if (event.type === 'cut') {
24958
+ removeBlocks(selectedBlockClientIds);
24959
+ } else if (event.type === 'paste') {
24960
+ if (eventDefaultPrevented) {
24961
+ // This was likely already handled in rich-text/use-paste-handler.js
24962
+ return;
24963
+ }
 
24964
 
24965
+ const {
24966
+ __experimentalCanUserUseUnfilteredHTML: canUserUseUnfilteredHTML
24967
+ } = getSettings();
24968
+ const {
24969
+ plainText,
24970
+ html
24971
+ } = getPasteEventData(event);
24972
+ const blocks = (0,external_wp_blocks_namespaceObject.pasteHandler)({
24973
+ HTML: html,
24974
+ plainText,
24975
+ mode: 'BLOCKS',
24976
+ canUserUseUnfilteredHTML
24977
+ });
24978
+ replaceBlocks(selectedBlockClientIds, blocks, blocks.length - 1, -1);
24979
+ }
24980
  }
 
 
 
 
 
 
24981
 
24982
+ node.ownerDocument.addEventListener('copy', handler);
24983
+ node.ownerDocument.addEventListener('cut', handler);
24984
+ node.ownerDocument.addEventListener('paste', handler);
24985
+ return () => {
24986
+ node.ownerDocument.removeEventListener('copy', handler);
24987
+ node.ownerDocument.removeEventListener('cut', handler);
24988
+ node.ownerDocument.removeEventListener('paste', handler);
24989
+ };
24990
+ }, []);
24991
  }
 
 
24992
 
24993
+ function CopyHandler({
24994
+ children
24995
+ }) {
24996
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
24997
+ ref: useClipboardHandler()
24998
+ }, children);
24999
+ }
25000
 
25001
+ /* harmony default export */ var copy_handler = (CopyHandler);
25002
+ //# sourceMappingURL=index.js.map
25003
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-actions/index.js
25004
  /**
25005
  * External dependencies
25006
  */
25011
 
25012
 
25013
 
 
 
 
25014
  /**
25015
  * Internal dependencies
25016
  */
25017
 
25018
 
25019
 
25020
+ function BlockActions({
25021
+ clientIds,
25022
+ children,
25023
+ __experimentalUpdateSelection: updateSelection
25024
+ }) {
25025
+ const {
25026
+ canInsertBlockType,
25027
+ getBlockRootClientId,
25028
+ getBlocksByClientId,
25029
+ canMoveBlocks,
25030
+ canRemoveBlocks
25031
+ } = (0,external_wp_data_namespaceObject.useSelect)(store);
25032
+ const {
25033
+ getDefaultBlockName,
25034
+ getGroupingBlockName
25035
+ } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blocks_namespaceObject.store);
25036
+ const blocks = getBlocksByClientId(clientIds);
25037
+ const rootClientId = getBlockRootClientId(clientIds[0]);
25038
+ const canDuplicate = (0,external_lodash_namespaceObject.every)(blocks, block => {
25039
+ return !!block && (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'multiple', true) && canInsertBlockType(block.name, rootClientId);
25040
+ });
25041
+ const canInsertDefaultBlock = canInsertBlockType(getDefaultBlockName(), rootClientId);
25042
+ const canMove = canMoveBlocks(clientIds, rootClientId);
25043
+ const canRemove = canRemoveBlocks(clientIds, rootClientId);
25044
+ const {
25045
+ removeBlocks,
25046
+ replaceBlocks,
25047
+ duplicateBlocks,
25048
+ insertAfterBlock,
25049
+ insertBeforeBlock,
25050
+ flashBlock,
25051
+ setBlockMovingClientId,
25052
+ setNavigationMode,
25053
+ selectBlock
25054
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
25055
+ const notifyCopy = useNotifyCopy();
25056
+ return children({
25057
+ canDuplicate,
25058
+ canInsertDefaultBlock,
25059
+ canMove,
25060
+ canRemove,
25061
+ rootClientId,
25062
+ blocks,
25063
+
25064
+ onDuplicate() {
25065
+ return duplicateBlocks(clientIds, updateSelection);
25066
+ },
25067
+
25068
+ onRemove() {
25069
+ return removeBlocks(clientIds, updateSelection);
25070
+ },
25071
+
25072
+ onInsertBefore() {
25073
+ insertBeforeBlock((0,external_lodash_namespaceObject.first)((0,external_lodash_namespaceObject.castArray)(clientIds)));
25074
+ },
25075
 
25076
+ onInsertAfter() {
25077
+ insertAfterBlock((0,external_lodash_namespaceObject.last)((0,external_lodash_namespaceObject.castArray)(clientIds)));
25078
+ },
25079
 
25080
+ onMoveTo() {
25081
+ setNavigationMode(true);
25082
+ selectBlock(clientIds[0]);
25083
+ setBlockMovingClientId(clientIds[0]);
25084
+ },
25085
 
25086
+ onGroup() {
25087
+ if (!blocks.length) {
25088
+ return;
25089
+ }
25090
 
25091
+ const groupingBlockName = getGroupingBlockName(); // Activate the `transform` on `core/group` which does the conversion
25092
 
25093
+ const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocks, groupingBlockName);
25094
 
25095
+ if (!newBlocks) {
25096
+ return;
25097
+ }
25098
 
25099
+ replaceBlocks(clientIds, newBlocks);
25100
+ },
25101
 
25102
+ onUngroup() {
25103
+ if (!blocks.length) {
25104
+ return;
25105
+ }
 
 
 
25106
 
25107
+ const innerBlocks = blocks[0].innerBlocks;
25108
 
25109
+ if (!innerBlocks.length) {
25110
+ return;
25111
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25112
 
25113
+ replaceBlocks(clientIds, innerBlocks);
25114
+ },
 
 
25115
 
25116
+ onCopy() {
25117
+ const selectedBlockClientIds = blocks.map(({
25118
+ clientId
25119
+ }) => clientId);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25120
 
25121
+ if (blocks.length === 1) {
25122
+ flashBlock(selectedBlockClientIds[0]);
25123
+ }
25124
+
25125
+ notifyCopy('copy', selectedBlockClientIds);
25126
  }
25127
 
25128
+ });
 
25129
  }
25130
+ //# sourceMappingURL=index.js.map
25131
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-settings-menu/block-mode-toggle.js
25132
 
 
 
 
25133
 
25134
+ /**
25135
+ * External dependencies
25136
+ */
25137
 
25138
  /**
25139
  * WordPress dependencies
25141
 
25142
 
25143
 
 
 
 
 
 
 
 
 
25144
 
 
 
 
 
 
25145
 
 
 
 
25146
 
25147
+ /**
25148
+ * Internal dependencies
25149
+ */
 
 
 
 
 
25150
 
 
 
 
25151
 
25152
+ function BlockModeToggle({
25153
+ blockType,
25154
+ mode,
25155
+ onToggleMode,
25156
+ small = false,
25157
+ isCodeEditingEnabled = true
25158
+ }) {
25159
+ if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, 'html', true) || !isCodeEditingEnabled) {
25160
+ return null;
25161
+ }
25162
 
25163
+ const label = mode === 'visual' ? (0,external_wp_i18n_namespaceObject.__)('Edit as HTML') : (0,external_wp_i18n_namespaceObject.__)('Edit visually');
25164
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
25165
+ onClick: onToggleMode
25166
+ }, !small && label);
 
 
 
25167
  }
25168
+ /* harmony default export */ var block_mode_toggle = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, {
25169
+ clientId
25170
+ }) => {
25171
+ const {
25172
+ getBlock,
25173
+ getBlockMode,
25174
+ getSettings
25175
+ } = select(store);
25176
+ const block = getBlock(clientId);
25177
+ const isCodeEditingEnabled = getSettings().codeEditingEnabled;
25178
+ return {
25179
+ mode: getBlockMode(clientId),
25180
+ blockType: block ? (0,external_wp_blocks_namespaceObject.getBlockType)(block.name) : null,
25181
+ isCodeEditingEnabled
25182
+ };
25183
+ }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, {
25184
+ onToggle = external_lodash_namespaceObject.noop,
25185
+ clientId
25186
+ }) => ({
25187
+ onToggleMode() {
25188
+ dispatch(store).toggleBlockMode(clientId);
25189
+ onToggle();
25190
+ }
25191
 
25192
+ }))])(BlockModeToggle));
25193
+ //# sourceMappingURL=block-mode-toggle.js.map
25194
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-settings-menu/block-convert-button.js
25195
 
25196
 
25197
  /**
25199
  */
25200
 
25201
 
25202
+ function BlockConvertButton({
25203
+ shouldRender,
25204
+ onClick,
25205
+ small
25206
+ }) {
25207
+ if (!shouldRender) {
25208
+ return null;
25209
+ }
25210
+
25211
+ const label = (0,external_wp_i18n_namespaceObject.__)('Convert to Blocks');
25212
+
25213
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
25214
+ onClick: onClick
25215
+ }, !small && label);
25216
+ }
25217
+ //# sourceMappingURL=block-convert-button.js.map
25218
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-settings-menu/block-html-convert-button.js
25219
+ /**
25220
+ * WordPress dependencies
25221
+ */
25222
+
25223
 
25224
 
25225
  /**
25228
 
25229
 
25230
 
25231
+ /* harmony default export */ var block_html_convert_button = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, {
25232
+ clientId
25233
+ }) => {
25234
+ const block = select(store).getBlock(clientId);
25235
+ return {
25236
+ block,
25237
+ shouldRender: block && block.name === 'core/html'
25238
+ };
25239
+ }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, {
25240
+ block
25241
+ }) => ({
25242
+ onClick: () => dispatch(store).replaceBlocks(block.clientId, (0,external_wp_blocks_namespaceObject.rawHandler)({
25243
+ HTML: (0,external_wp_blocks_namespaceObject.getBlockContent)(block)
25244
+ }))
25245
+ })))(BlockConvertButton));
25246
+ //# sourceMappingURL=block-html-convert-button.js.map
25247
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-settings-menu/block-settings-menu-first-item.js
25248
+ /**
25249
+ * WordPress dependencies
25250
+ */
25251
+
25252
+ const {
25253
+ Fill: __unstableBlockSettingsMenuFirstItem,
25254
+ Slot: block_settings_menu_first_item_Slot
25255
+ } = (0,external_wp_components_namespaceObject.createSlotFill)('__unstableBlockSettingsMenuFirstItem');
25256
+ __unstableBlockSettingsMenuFirstItem.Slot = block_settings_menu_first_item_Slot;
25257
+ /* harmony default export */ var block_settings_menu_first_item = (__unstableBlockSettingsMenuFirstItem);
25258
+ //# sourceMappingURL=block-settings-menu-first-item.js.map
25259
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/convert-to-group-buttons/index.js
25260
+
25261
+
25262
+ /**
25263
+ * WordPress dependencies
25264
+ */
25265
 
25266
 
25267
 
25268
 
25269
+ /**
25270
+ * Internal dependencies
25271
+ */
25272
 
25273
 
25274
 
25275
 
25276
+ function ConvertToGroupButton({
25277
+ clientIds,
25278
+ isGroupable,
25279
+ isUngroupable,
25280
+ blocksSelection,
25281
+ groupingBlockName,
25282
+ onClose = () => {}
 
 
 
25283
  }) {
 
 
 
 
 
 
 
 
 
 
25284
  const {
25285
+ replaceBlocks
25286
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
 
 
25287
 
25288
+ const onConvertToGroup = () => {
25289
+ // Activate the `transform` on the Grouping Block which does the conversion
25290
+ const newBlocks = (0,external_wp_blocks_namespaceObject.switchToBlockType)(blocksSelection, groupingBlockName);
25291
+
25292
+ if (newBlocks) {
25293
+ replaceBlocks(clientIds, newBlocks);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25294
  }
25295
+ };
25296
 
25297
+ const onConvertFromGroup = () => {
25298
+ const innerBlocks = blocksSelection[0].innerBlocks;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25299
 
25300
+ if (!innerBlocks.length) {
25301
+ return;
25302
+ }
25303
 
25304
+ replaceBlocks(clientIds, innerBlocks);
25305
+ };
25306
 
25307
+ if (!isGroupable && !isUngroupable) {
25308
+ return null;
25309
+ }
25310
+
25311
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isGroupable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
25312
+ onClick: () => {
25313
+ onConvertToGroup();
25314
+ onClose();
25315
+ }
25316
+ }, (0,external_wp_i18n_namespaceObject._x)('Group', 'verb')), isUngroupable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
25317
+ onClick: () => {
25318
+ onConvertFromGroup();
25319
+ onClose();
25320
+ }
25321
+ }, (0,external_wp_i18n_namespaceObject._x)('Ungroup', 'Ungrouping blocks from within a Group block back into individual blocks within the Editor ')));
25322
+ }
25323
 
25324
+
25325
+ //# sourceMappingURL=index.js.map
25326
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js
25327
  /**
25328
  * WordPress dependencies
25329
  */
25330
 
25331
 
 
 
 
25332
  /**
25333
  * Internal dependencies
25334
  */
25335
 
25336
 
25337
+ /**
25338
+ * Contains the properties `ConvertToGroupButton` component needs.
25339
+ *
25340
+ * @typedef {Object} ConvertToGroupButtonProps
25341
+ * @property {string[]} clientIds An array of the selected client ids.
25342
+ * @property {boolean} isGroupable Indicates if the selected blocks can be grouped.
25343
+ * @property {boolean} isUngroupable Indicates if the selected blocks can be ungrouped.
25344
+ * @property {WPBlock[]} blocksSelection An array of the selected blocks.
25345
+ * @property {string} groupingBlockName The name of block used for handling grouping interactions.
25346
+ */
25347
 
25348
+ /**
25349
+ * Returns the properties `ConvertToGroupButton` component needs to work properly.
25350
+ * It is used in `BlockSettingsMenuControls` to know if `ConvertToGroupButton`
25351
+ * should be rendered, to avoid ending up with an empty MenuGroup.
25352
+ *
25353
+ * @return {ConvertToGroupButtonProps} Returns the properties needed by `ConvertToGroupButton`.
25354
+ */
25355
 
25356
+ function useConvertToGroupButtonProps() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25357
  const {
25358
+ clientIds,
25359
+ isGroupable,
25360
+ isUngroupable,
25361
+ blocksSelection,
25362
+ groupingBlockName
25363
  } = (0,external_wp_data_namespaceObject.useSelect)(select => {
25364
+ var _blocksSelection$;
25365
+
25366
  const {
25367
+ getBlockRootClientId,
25368
+ getBlocksByClientId,
25369
+ canInsertBlockType,
25370
+ getSelectedBlockClientIds
25371
  } = select(store);
25372
+ const {
25373
+ getGroupingBlockName
25374
+ } = select(external_wp_blocks_namespaceObject.store);
 
 
 
 
 
 
 
 
 
25375
 
25376
+ const _clientIds = getSelectedBlockClientIds();
 
 
 
 
 
 
25377
 
25378
+ const _groupingBlockName = getGroupingBlockName();
25379
+
25380
+ const rootClientId = !!(_clientIds !== null && _clientIds !== void 0 && _clientIds.length) ? getBlockRootClientId(_clientIds[0]) : undefined;
25381
+ const groupingBlockAvailable = canInsertBlockType(_groupingBlockName, rootClientId);
25382
+
25383
+ const _blocksSelection = getBlocksByClientId(_clientIds);
25384
+
25385
+ const isSingleGroupingBlock = _blocksSelection.length === 1 && ((_blocksSelection$ = _blocksSelection[0]) === null || _blocksSelection$ === void 0 ? void 0 : _blocksSelection$.name) === _groupingBlockName; // Do we have
25386
+ // 1. Grouping block available to be inserted?
25387
+ // 2. One or more blocks selected
25388
+ // (we allow single Blocks to become groups unless
25389
+ // they are a soltiary group block themselves)
25390
+
25391
+ const _isGroupable = groupingBlockAvailable && _blocksSelection.length && !isSingleGroupingBlock; // Do we have a single Group Block selected and does that group have inner blocks?
25392
+
25393
+
25394
+ const _isUngroupable = isSingleGroupingBlock && !!_blocksSelection[0].innerBlocks.length;
25395
+
25396
+ return {
25397
+ clientIds: _clientIds,
25398
+ isGroupable: _isGroupable,
25399
+ isUngroupable: _isUngroupable,
25400
+ blocksSelection: _blocksSelection,
25401
+ groupingBlockName: _groupingBlockName
25402
+ };
25403
+ }, []);
25404
+ return {
25405
+ clientIds,
25406
+ isGroupable,
25407
+ isUngroupable,
25408
+ blocksSelection,
25409
+ groupingBlockName
25410
+ };
25411
  }
25412
+ //# sourceMappingURL=use-convert-to-group-button-props.js.map
25413
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-settings-menu-controls/index.js
25414
 
25415
 
25416
 
25418
  * External dependencies
25419
  */
25420
 
 
25421
  /**
25422
  * WordPress dependencies
25423
  */
25424
 
25425
 
25426
 
 
 
 
 
 
 
25427
  /**
25428
  * Internal dependencies
25429
  */
25430
 
25431
 
25432
 
25433
+ const {
25434
+ Fill,
25435
+ Slot: block_settings_menu_controls_Slot
25436
+ } = (0,external_wp_components_namespaceObject.createSlotFill)('BlockSettingsMenuControls');
25437
 
25438
+ const BlockSettingsMenuControlsSlot = ({
25439
+ fillProps,
25440
+ clientIds = null
 
 
 
 
 
25441
  }) => {
 
 
 
 
 
 
 
 
 
25442
  const {
25443
+ selectedBlocks,
25444
+ selectedClientIds
25445
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
25446
+ const {
25447
+ getBlocksByClientId,
25448
+ getSelectedBlockClientIds
25449
+ } = select(store);
25450
+ const ids = clientIds !== null ? clientIds : getSelectedBlockClientIds();
25451
+ return {
25452
+ selectedBlocks: (0,external_lodash_namespaceObject.map)((0,external_lodash_namespaceObject.compact)(getBlocksByClientId(ids)), block => block.name),
25453
+ selectedClientIds: ids
25454
+ };
25455
+ }, [clientIds]); // Check if current selection of blocks is Groupable or Ungroupable
25456
+ // and pass this props down to ConvertToGroupButton.
25457
 
25458
+ const convertToGroupButtonProps = useConvertToGroupButtonProps();
25459
+ const {
25460
+ isGroupable,
25461
+ isUngroupable
25462
+ } = convertToGroupButtonProps;
25463
+ const showConvertToGroupButton = isGroupable || isUngroupable;
25464
+ return (0,external_wp_element_namespaceObject.createElement)(block_settings_menu_controls_Slot, {
25465
+ fillProps: { ...fillProps,
25466
+ selectedBlocks,
25467
+ selectedClientIds
25468
  }
25469
+ }, fills => {
25470
+ if ((fills === null || fills === void 0 ? void 0 : fills.length) > 0 || showConvertToGroupButton) {
25471
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, fills, (0,external_wp_element_namespaceObject.createElement)(ConvertToGroupButton, _extends({}, convertToGroupButtonProps, {
25472
+ onClose: fillProps === null || fillProps === void 0 ? void 0 : fillProps.onClose
25473
+ })));
25474
  }
25475
+ });
 
 
 
 
 
 
 
 
 
 
 
25476
  };
25477
+ /**
25478
+ * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-settings-menu-controls/README.md
25479
+ *
25480
+ * @param {Object} props Fill props.
25481
+ * @return {WPElement} Element.
25482
+ */
25483
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25484
 
25485
+ function BlockSettingsMenuControls({ ...props
25486
+ }) {
25487
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalStyleProvider, {
25488
+ document: document
25489
+ }, (0,external_wp_element_namespaceObject.createElement)(Fill, props));
25490
+ }
25491
 
25492
+ BlockSettingsMenuControls.Slot = BlockSettingsMenuControlsSlot;
25493
+ /* harmony default export */ var block_settings_menu_controls = (BlockSettingsMenuControls);
25494
+ //# sourceMappingURL=index.js.map
25495
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-settings-menu/block-settings-dropdown.js
 
 
 
 
 
 
 
 
25496
 
 
 
 
 
 
 
 
 
 
 
25497
 
 
 
 
 
 
 
 
 
 
 
25498
 
25499
+ /**
25500
+ * External dependencies
25501
+ */
 
 
 
 
 
 
25502
 
25503
+ /**
25504
+ * WordPress dependencies
25505
+ */
 
 
25506
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25507
 
 
25508
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25509
 
 
25510
 
 
25511
 
 
 
25512
 
 
 
 
25513
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25514
 
25515
+ /**
25516
+ * Internal dependencies
25517
+ */
25518
 
 
 
 
 
 
 
 
25519
 
 
 
 
25520
 
25521
 
 
25522
 
 
 
 
25523
 
25524
 
25525
+ const block_settings_dropdown_POPOVER_PROPS = {
25526
+ className: 'block-editor-block-settings-menu__popover',
25527
+ position: 'bottom right',
25528
+ isAlternate: true
25529
+ };
25530
 
25531
+ function CopyMenuItem({
25532
+ blocks,
25533
+ onCopy
25534
+ }) {
25535
+ const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(() => (0,external_wp_blocks_namespaceObject.serialize)(blocks), onCopy);
25536
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
25537
+ ref: ref
25538
+ }, (0,external_wp_i18n_namespaceObject.__)('Copy'));
25539
+ }
25540
 
25541
+ function BlockSettingsDropdown({
25542
+ clientIds,
25543
+ __experimentalSelectBlock,
25544
+ children,
25545
+ ...props
25546
+ }) {
25547
+ const blockClientIds = (0,external_lodash_namespaceObject.castArray)(clientIds);
25548
+ const count = blockClientIds.length;
25549
+ const firstBlockClientId = blockClientIds[0];
25550
+ const onlyBlock = (0,external_wp_data_namespaceObject.useSelect)(select => 1 === select(store).getBlockCount(), []);
25551
+ const shortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => {
25552
+ const {
25553
+ getShortcutRepresentation
25554
+ } = select(external_wp_keyboardShortcuts_namespaceObject.store);
25555
+ return {
25556
+ duplicate: getShortcutRepresentation('core/block-editor/duplicate'),
25557
+ remove: getShortcutRepresentation('core/block-editor/remove'),
25558
+ insertAfter: getShortcutRepresentation('core/block-editor/insert-after'),
25559
+ insertBefore: getShortcutRepresentation('core/block-editor/insert-before')
25560
+ };
25561
+ }, []);
25562
+ const updateSelection = (0,external_wp_element_namespaceObject.useCallback)(__experimentalSelectBlock ? async clientIdsPromise => {
25563
+ const ids = await clientIdsPromise;
25564
 
25565
+ if (ids && ids[0]) {
25566
+ __experimentalSelectBlock(ids[0]);
 
25567
  }
25568
+ } : external_lodash_namespaceObject.noop, [__experimentalSelectBlock]);
25569
+ const removeBlockLabel = count === 1 ? (0,external_wp_i18n_namespaceObject.__)('Remove block') : (0,external_wp_i18n_namespaceObject.__)('Remove blocks');
25570
+ return (0,external_wp_element_namespaceObject.createElement)(BlockActions, {
25571
+ clientIds: clientIds,
25572
+ __experimentalUpdateSelection: !__experimentalSelectBlock
25573
+ }, ({
25574
+ canDuplicate,
25575
+ canInsertDefaultBlock,
25576
+ canMove,
25577
+ canRemove,
25578
+ onDuplicate,
25579
+ onInsertAfter,
25580
+ onInsertBefore,
25581
+ onRemove,
25582
+ onCopy,
25583
+ onMoveTo,
25584
+ blocks
25585
+ }) => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, _extends({
25586
+ icon: more_vertical,
25587
+ label: (0,external_wp_i18n_namespaceObject.__)('Options'),
25588
+ className: "block-editor-block-settings-menu",
25589
+ popoverProps: block_settings_dropdown_POPOVER_PROPS,
25590
+ noIcons: true
25591
+ }, props), ({
25592
+ onClose
25593
+ }) => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(block_settings_menu_first_item.Slot, {
25594
+ fillProps: {
25595
+ onClose
25596
+ }
25597
+ }), count === 1 && (0,external_wp_element_namespaceObject.createElement)(block_html_convert_button, {
25598
+ clientId: firstBlockClientId
25599
+ }), (0,external_wp_element_namespaceObject.createElement)(CopyMenuItem, {
25600
+ blocks: blocks,
25601
+ onCopy: onCopy
25602
+ }), canDuplicate && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
25603
+ onClick: (0,external_lodash_namespaceObject.flow)(onClose, onDuplicate, updateSelection),
25604
+ shortcut: shortcuts.duplicate
25605
+ }, (0,external_wp_i18n_namespaceObject.__)('Duplicate')), canInsertDefaultBlock && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
25606
+ onClick: (0,external_lodash_namespaceObject.flow)(onClose, onInsertBefore),
25607
+ shortcut: shortcuts.insertBefore
25608
+ }, (0,external_wp_i18n_namespaceObject.__)('Insert before')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
25609
+ onClick: (0,external_lodash_namespaceObject.flow)(onClose, onInsertAfter),
25610
+ shortcut: shortcuts.insertAfter
25611
+ }, (0,external_wp_i18n_namespaceObject.__)('Insert after'))), canMove && !onlyBlock && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
25612
+ onClick: (0,external_lodash_namespaceObject.flow)(onClose, onMoveTo)
25613
+ }, (0,external_wp_i18n_namespaceObject.__)('Move to')), count === 1 && (0,external_wp_element_namespaceObject.createElement)(block_mode_toggle, {
25614
+ clientId: firstBlockClientId,
25615
+ onToggle: onClose
25616
+ })), (0,external_wp_element_namespaceObject.createElement)(block_settings_menu_controls.Slot, {
25617
+ fillProps: {
25618
+ onClose
25619
+ },
25620
+ clientIds: clientIds
25621
+ }), typeof children === 'function' ? children({
25622
+ onClose
25623
+ }) : external_wp_element_namespaceObject.Children.map(child => (0,external_wp_element_namespaceObject.cloneElement)(child, {
25624
+ onClose
25625
+ })), canRemove && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
25626
+ onClick: (0,external_lodash_namespaceObject.flow)(onClose, onRemove, updateSelection),
25627
+ shortcut: shortcuts.remove
25628
+ }, removeBlockLabel)))));
25629
+ }
25630
+ /* harmony default export */ var block_settings_dropdown = (BlockSettingsDropdown);
25631
+ //# sourceMappingURL=block-settings-dropdown.js.map
25632
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-settings-menu/index.js
25633
 
25634
 
 
 
 
25635
 
25636
  /**
25637
  * WordPress dependencies
25638
  */
25639
 
 
 
 
 
 
25640
  /**
25641
  * Internal dependencies
25642
  */
25643
 
25644
 
25645
+ function BlockSettingsMenu({
25646
+ clientIds,
25647
+ ...props
25648
+ }) {
25649
+ return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, null, toggleProps => (0,external_wp_element_namespaceObject.createElement)(block_settings_dropdown, _extends({
25650
+ clientIds: clientIds,
25651
+ toggleProps: toggleProps
25652
+ }, props))));
25653
+ }
25654
+ /* harmony default export */ var block_settings_menu = (BlockSettingsMenu);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25655
  //# sourceMappingURL=index.js.map
25656
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-toolbar/index.js
25657
+
25658
 
25659
 
25660
  /**
25676
 
25677
 
25678
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25679
 
 
 
 
 
 
 
25680
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25681
 
25682
+
25683
+
25684
+ function BlockToolbar({
25685
+ hideDragHandle
25686
+ }) {
25687
+ const {
25688
+ blockClientIds,
25689
+ blockClientId,
25690
+ blockType,
25691
+ hasFixedToolbar,
25692
+ hasReducedUI,
25693
+ isValid,
25694
+ isVisual
25695
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
25696
+ const {
25697
+ getBlockName,
25698
+ getBlockMode,
25699
+ getSelectedBlockClientIds,
25700
+ isBlockValid,
25701
+ getBlockRootClientId,
25702
+ getSettings
25703
+ } = select(store);
25704
+ const selectedBlockClientIds = getSelectedBlockClientIds();
25705
+ const selectedBlockClientId = selectedBlockClientIds[0];
25706
+ const blockRootClientId = getBlockRootClientId(selectedBlockClientId);
25707
+ const settings = getSettings();
25708
+ return {
25709
+ blockClientIds: selectedBlockClientIds,
25710
+ blockClientId: selectedBlockClientId,
25711
+ blockType: selectedBlockClientId && (0,external_wp_blocks_namespaceObject.getBlockType)(getBlockName(selectedBlockClientId)),
25712
+ hasFixedToolbar: settings.hasFixedToolbar,
25713
+ hasReducedUI: settings.hasReducedUI,
25714
+ rootClientId: blockRootClientId,
25715
+ isValid: selectedBlockClientIds.every(id => isBlockValid(id)),
25716
+ isVisual: selectedBlockClientIds.every(id => getBlockMode(id) === 'visual')
25717
+ };
25718
+ }, []); // Handles highlighting the current block outline on hover or focus of the
25719
+ // block type toolbar area.
25720
+
25721
+ const {
25722
+ toggleBlockHighlight
25723
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store);
25724
+ const nodeRef = (0,external_wp_element_namespaceObject.useRef)();
25725
+ const {
25726
+ showMovers,
25727
+ gestures: showMoversGestures
25728
+ } = useShowMoversGestures({
25729
+ ref: nodeRef,
25730
+
25731
+ onChange(isFocused) {
25732
+ if (isFocused && hasReducedUI) {
25733
+ return;
25734
  }
25735
 
25736
+ toggleBlockHighlight(blockClientId, isFocused);
25737
+ }
 
 
 
 
 
 
 
 
25738
 
25739
+ }); // Account for the cases where the block toolbar is rendered within the
25740
+ // header area and not contextually to the block.
25741
 
25742
+ const displayHeaderToolbar = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<') || hasFixedToolbar;
 
 
 
 
 
 
 
 
25743
 
25744
+ if (blockType) {
25745
+ if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, '__experimentalToolbar', true)) {
25746
+ return null;
25747
+ }
25748
+ }
25749
+
25750
+ const shouldShowMovers = displayHeaderToolbar || showMovers;
25751
+
25752
+ if (blockClientIds.length === 0) {
25753
+ return null;
25754
+ }
25755
+
25756
+ const shouldShowVisualToolbar = isValid && isVisual;
25757
+ const isMultiToolbar = blockClientIds.length > 1;
25758
+ const classes = classnames_default()('block-editor-block-toolbar', shouldShowMovers && 'is-showing-movers');
25759
+ return (0,external_wp_element_namespaceObject.createElement)("div", {
25760
+ className: classes
25761
+ }, !isMultiToolbar && !displayHeaderToolbar && (0,external_wp_element_namespaceObject.createElement)(BlockParentSelector, {
25762
+ clientIds: blockClientIds
25763
+ }), (0,external_wp_element_namespaceObject.createElement)("div", _extends({
25764
+ ref: nodeRef
25765
+ }, showMoversGestures), (shouldShowVisualToolbar || isMultiToolbar) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, {
25766
+ className: "block-editor-block-toolbar__block-controls"
25767
+ }, (0,external_wp_element_namespaceObject.createElement)(block_switcher, {
25768
+ clientIds: blockClientIds
25769
+ }), (0,external_wp_element_namespaceObject.createElement)(block_mover, {
25770
+ clientIds: blockClientIds,
25771
+ hideDragHandle: hideDragHandle || hasReducedUI
25772
+ }))), shouldShowVisualToolbar && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(block_controls.Slot, {
25773
+ group: "parent",
25774
+ className: "block-editor-block-toolbar__slot"
25775
+ }), (0,external_wp_element_namespaceObject.createElement)(block_controls.Slot, {
25776
+ group: "block",
25777
+ className: "block-editor-block-toolbar__slot"
25778
+ }), (0,external_wp_element_namespaceObject.createElement)(block_controls.Slot, {
25779
+ className: "block-editor-block-toolbar__slot"
25780
+ }), (0,external_wp_element_namespaceObject.createElement)(block_controls.Slot, {
25781
+ group: "inline",
25782
+ className: "block-editor-block-toolbar__slot"
25783
+ }), (0,external_wp_element_namespaceObject.createElement)(block_controls.Slot, {
25784
+ group: "other",
25785
+ className: "block-editor-block-toolbar__slot"
25786
+ })), (0,external_wp_element_namespaceObject.createElement)(block_settings_menu, {
25787
+ clientIds: blockClientIds
25788
+ }));
25789
+ }
25790
  //# sourceMappingURL=index.js.map
25791
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-tools/block-contextual-toolbar.js
25792
+
25793
 
25794
 
25795
  /**
25796
  * External dependencies
25797
  */
25798
 
 
25799
  /**
25800
  * WordPress dependencies
25801
  */
25802
 
25803
 
25804
 
25805
+
25806
  /**
25807
  * Internal dependencies
25808
  */
25811
 
25812
 
25813
 
25814
+ function BlockContextualToolbar({
25815
+ focusOnMount,
25816
+ isFixed,
25817
+ ...props
 
 
 
 
 
25818
  }) {
25819
+ const {
25820
+ blockType,
25821
+ hasParents,
25822
+ showParentSelector
25823
+ } = (0,external_wp_data_namespaceObject.useSelect)(select => {
25824
+ const {
25825
+ getBlockName,
25826
+ getBlockParents,
25827
+ getSelectedBlockClientIds
25828
+ } = select(store);
25829
+ const {
25830
+ getBlockType
25831
+ } = select(external_wp_blocks_namespaceObject.store);
25832
+ const selectedBlockClientIds = getSelectedBlockClientIds();
25833
+ const selectedBlockClientId = selectedBlockClientIds[0];
25834
+ const parents = getBlockParents(selectedBlockClientId);
25835
+ const firstParentClientId = parents[parents.length - 1];
25836
+ const parentBlockName = getBlockName(firstParentClientId);
25837
+ const parentBlockType = getBlockType(parentBlockName);
25838
+ return {
25839
+ blockType: selectedBlockClientId && getBlockType(getBlockName(selectedBlockClientId)),
25840
+ hasParents: parents.length,
25841
+ showParentSelector: (0,external_wp_blocks_namespaceObject.hasBlockSupport)(parentBlockType, '__experimentalParentSelector', true) && selectedBlockClientIds.length <= 1
25842
+ };
25843
+ }, []);
25844
 
25845
+ if (blockType) {
25846
+ if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(blockType, '__experimentalToolbar', true)) {
25847
  return null;
25848
  }
25849
+ } // Shifts the toolbar to make room for the parent block selector.
25850
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25851
 
25852
+ const classes = classnames_default()('block-editor-block-contextual-toolbar', {
25853
+ 'has-parent': hasParents && showParentSelector,
25854
+ 'is-fixed': isFixed
25855
+ });
25856
+ return (0,external_wp_element_namespaceObject.createElement)(navigable_toolbar, _extends({
25857
+ focusOnMount: focusOnMount,
25858
+ className: classes
25859
+ /* translators: accessibility text for the block toolbar */
25860
+ ,
25861
+ "aria-label": (0,external_wp_i18n_namespaceObject.__)('Block tools')
25862
+ }, props), (0,external_wp_element_namespaceObject.createElement)(BlockToolbar, {
25863
+ hideDragHandle: isFixed
25864
+ }));
25865
  }
25866
 
25867
+ /* harmony default export */ var block_contextual_toolbar = (BlockContextualToolbar);
25868
+ //# sourceMappingURL=block-contextual-toolbar.js.map
25869
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-tools/block-popover.js
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25870
 
25871
 
25872
  /**
25873
  * External dependencies
25874
  */
25875
 
25876
+
25877
  /**
25878
  * WordPress dependencies
25879
  */
25882
 
25883
 
25884
 
25885
+
25886
+
25887
+
25888
  /**
25889
  * Internal dependencies
25890
  */
25893
 
25894
 
25895
 
 
25896
 
25897
+
25898
+
25899
+ function block_popover_selector(select) {
25900
+ const {
25901
+ isNavigationMode,
25902
+ isMultiSelecting,
25903
+ hasMultiSelection,
25904
+ isTyping,
25905
+ isCaretWithinFormattedText,
25906
+ getSettings,
25907
+ getLastMultiSelectedBlockClientId
25908
+ } = select(store);
25909
+ return {
25910
+ isNavigationMode: isNavigationMode(),
25911
+ isMultiSelecting: isMultiSelecting(),
25912
+ isTyping: isTyping(),
25913
+ isCaretWithinFormattedText: isCaretWithinFormattedText(),
25914
+ hasMultiSelection: hasMultiSelection(),
25915
+ hasFixedToolbar: getSettings().hasFixedToolbar,
25916
+ lastClientId: getLastMultiSelectedBlockClientId()
25917
+ };
25918
+ }
25919
+
25920
+ function BlockPopover({
25921
+ clientId,
25922
+ rootClientId,
25923
+ isValid,
25924
+ isEmptyDefaultBlock,
25925
+ capturingClientId,
25926
  __unstablePopoverSlot,
25927
  __unstableContentRef
25928
  }) {
25929
  const {
25930
+ isNavigationMode,
25931
+ isMultiSelecting,
25932
+ isTyping,
25933
+ isCaretWithinFormattedText,
25934
+ hasMultiSelection,
25935
+ hasFixedToolbar,
25936
+ lastClientId
25937
+ } = (0,external_wp_data_namespaceObject.useSelect)(block_popover_selector, []);
25938
+ const isInsertionPointVisible = (0,external_wp_data_namespaceObject.useSelect)(select => {
 
 
 
 
25939
  const {
25940
+ isBlockInsertionPointVisible,
 
25941
  getBlockInsertionPoint,
25942
+ getBlockOrder
 
 
25943
  } = select(store);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25944
 
25945
+ if (!isBlockInsertionPointVisible()) {
25946
+ return false;
 
 
 
 
 
 
25947
  }
25948
 
25949
+ const insertionPoint = getBlockInsertionPoint();
25950
+ const order = getBlockOrder(insertionPoint.rootClientId);
25951
+ return order[insertionPoint.index] === clientId;
25952
+ }, [clientId]);
25953
+ const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
25954
+ const [isToolbarForced, setIsToolbarForced] = (0,external_wp_element_namespaceObject.useState)(false);
25955
+ const [isInserterShown, setIsInserterShown] = (0,external_wp_element_namespaceObject.useState)(false);
25956
+ const {
25957
+ stopTyping
25958
+ } = (0,external_wp_data_namespaceObject.useDispatch)(store); // Controls when the side inserter on empty lines should
25959
+ // be shown, including writing and selection modes.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25960
 
25961
+ const showEmptyBlockSideInserter = !isTyping && !isNavigationMode && isEmptyDefaultBlock && isValid;
25962
+ const shouldShowBreadcrumb = isNavigationMode;
25963
+ const shouldShowContextualToolbar = !isNavigationMode && !hasFixedToolbar && isLargeViewport && !showEmptyBlockSideInserter && !isMultiSelecting && (!isTyping || isCaretWithinFormattedText);
25964
+ const canFocusHiddenToolbar = !isNavigationMode && !shouldShowContextualToolbar && !hasFixedToolbar && !isEmptyDefaultBlock;
25965
+ (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/block-editor/focus-toolbar', () => {
25966
+ setIsToolbarForced(true);
25967
+ stopTyping(true);
25968
+ }, {
25969
+ isDisabled: !canFocusHiddenToolbar
25970
+ });
25971
+ (0,external_wp_element_namespaceObject.useEffect)(() => {
25972
+ if (!shouldShowContextualToolbar) {
25973
+ setIsToolbarForced(false);
25974
  }
25975
+ }, [shouldShowContextualToolbar]); // Stores the active toolbar item index so the block toolbar can return focus
25976
+ // to it when re-mounting.
25977
 
25978
+ const initialToolbarItemIndexRef = (0,external_wp_element_namespaceObject.useRef)();
25979
+ const selectedElement = useBlockElement(clientId);
25980
+ const lastSelectedElement = useBlockElement(lastClientId);
25981
+ const capturingElement = useBlockElement(capturingClientId);
 
 
 
 
25982
  const popoverScrollRef = usePopoverScroll(__unstableContentRef);
 
25983
 
25984
+ if (!shouldShowBreadcrumb && !shouldShowContextualToolbar && !isToolbarForced && !showEmptyBlockSideInserter) {
25985
+ return null;
 
 
25986
  }
25987
 
25988
+ let node = selectedElement;
25989
+
25990
+ if (!node) {
25991
+ return null;
25992
+ }
25993
+
25994
+ if (capturingClientId) {
25995
+ node = capturingElement;
25996
+ }
25997
+
25998
+ let anchorRef = node;
25999
+
26000
+ if (hasMultiSelection) {
26001
+ // Wait to render the popover until the bottom reference is available
26002
+ // as well.
26003
+ if (!lastSelectedElement) {
26004
+ return null;
26005
  }
 
 
26006
 
26007
+ anchorRef = {
26008
+ top: node,
26009
+ bottom: lastSelectedElement
26010
+ };
26011
+ }
26012
 
26013
+ function onFocus() {
26014
+ setIsInserterShown(true);
26015
+ }
26016
+
26017
+ function onBlur() {
26018
+ setIsInserterShown(false);
26019
+ } // Position above the anchor, pop out towards the right, and position in the
26020
+ // left corner. For the side inserter, pop out towards the left, and
26021
+ // position in the right corner.
26022
+ // To do: refactor `Popover` to make this prop clearer.
26023
 
26024
+
26025
+ const popoverPosition = showEmptyBlockSideInserter ? 'top left right' : 'top right left';
26026
+ const {
26027
+ ownerDocument
26028
+ } = node;
26029
+ const stickyBoundaryElement = showEmptyBlockSideInserter ? undefined : // The sticky boundary element should be the boundary at which the
26030
+ // the block toolbar becomes sticky when the block scolls out of view.
26031
+ // In case of an iframe, this should be the iframe boundary, otherwise
26032
+ // the scroll container.
26033
+ ownerDocument.defaultView.frameElement || (0,external_wp_dom_namespaceObject.getScrollContainer)(node) || ownerDocument.body;
26034
  return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
26035
  ref: popoverScrollRef,
26036
  noArrow: true,
26037
  animate: false,
26038
+ position: popoverPosition,
26039
  focusOnMount: false,
26040
+ anchorRef: anchorRef,
26041
+ className: classnames_default()('block-editor-block-list__block-popover', {
26042
+ 'is-insertion-point-visible': isInsertionPointVisible
26043
+ }),
26044
+ __unstableStickyBoundaryElement: stickyBoundaryElement // Render in the old slot if needed for backward compatibility,
26045
  // otherwise render in place (not in the the default popover slot).
26046
  ,
26047
+ __unstableSlotName: __unstablePopoverSlot || null,
26048
+ __unstableBoundaryParent: true // Observe movement for block animations (especially horizontal).
26049
+ ,
26050
+ __unstableObserveElement: node,
26051
+ shouldAnchorIncludePadding: true // Used to safeguard sticky position behavior against cases where it would permanently
26052
+ // obscure specific sections of a block.
26053
+ ,
26054
+ __unstableEditorCanvasWrapper: __unstableContentRef === null || __unstableContentRef === void 0 ? void 0 : __unstableContentRef.current
26055
+ }, (shouldShowContextualToolbar || isToolbarForced) && (0,external_wp_element_namespaceObject.createElement)("div", {
26056
  onFocus: onFocus,
26057
+ onBlur: onBlur // While ideally it would be enough to capture the
26058
+ // bubbling focus event from the Inserter, due to the
26059
+ // characteristics of click focusing of `button`s in
26060
+ // Firefox and Safari, it is not reliable.
26061
+ //
26062
+ // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus
26063
+ ,
26064
+ tabIndex: -1,
26065
+ className: classnames_default()('block-editor-block-list__block-popover-inserter', {
26066
+ 'is-visible': isInserterShown
26067
+ })
26068
  }, (0,external_wp_element_namespaceObject.createElement)(inserter, {
26069
+ clientId: clientId,
 
26070
  rootClientId: rootClientId,
26071
+ __experimentalIsQuick: true
26072
+ })), (shouldShowContextualToolbar || isToolbarForced) && (0,external_wp_element_namespaceObject.createElement)(block_contextual_toolbar // If the toolbar is being shown because of being forced
26073
+ // it should focus the toolbar right after the mount.
26074
+ , {
26075
+ focusOnMount: isToolbarForced,
26076
+ __experimentalInitialIndex: initialToolbarItemIndexRef.current,
26077
+ __experimentalOnIndexChange: index => {
26078
+ initialToolbarItemIndexRef.current = index;
26079
+ } // Resets the index whenever the active block changes so
26080
+ // this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
26081
+ ,
26082
+ key: clientId
26083
+ }), shouldShowBreadcrumb && (0,external_wp_element_namespaceObject.createElement)(block_selection_button, {
26084
+ clientId: clientId,
26085
+ rootClientId: rootClientId,
26086
+ blockElement: node
26087
+ }), showEmptyBlockSideInserter && (0,external_wp_element_namespaceObject.createElement)("div", {
26088
+ className: "block-editor-block-list__empty-block-inserter"
26089
+ }, (0,external_wp_element_namespaceObject.createElement)(inserter, {
26090
+ position: "bottom right",
26091
+ rootClientId: rootClientId,
26092
+ clientId: clientId,
26093
+ __experimentalIsQuick: true
26094
+ })));
26095
  }
26096
 
26097
+ function wrapperSelector(select) {
26098
+ const {
26099
+ getSelectedBlockClientId,
26100
+ getFirstMultiSelectedBlockClientId,
26101
+ getBlockRootClientId,
26102
+ getBlock,
26103
+ getBlockParents,
26104
+ __experimentalGetBlockListSettingsForBlocks
26105
+ } = select(store);
26106
+ const clientId = getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();
26107
+
26108
+ if (!clientId) {
26109
+ return;
26110
+ }
26111
+
26112
+ const {
26113
+ name,
26114
+ attributes = {},
26115
+ isValid
26116
+ } = getBlock(clientId) || {};
26117
+ const blockParentsClientIds = getBlockParents(clientId); // Get Block List Settings for all ancestors of the current Block clientId
26118
+
26119
+ const parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(blockParentsClientIds); // Get the clientId of the topmost parent with the capture toolbars setting.
26120
+
26121
+
26122
+ const capturingClientId = (0,external_lodash_namespaceObject.find)(blockParentsClientIds, parentClientId => {
26123
+ var _parentBlockListSetti;
26124
+
26125
+ return (_parentBlockListSetti = parentBlockListSettings[parentClientId]) === null || _parentBlockListSetti === void 0 ? void 0 : _parentBlockListSetti.__experimentalCaptureToolbars;
26126
+ });
26127
+ return {
26128
+ clientId,
26129
+ rootClientId: getBlockRootClientId(clientId),
26130
+ name,
26131
+ isValid,
26132
+ isEmptyDefaultBlock: name && (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)({
26133
+ name,
26134
+ attributes
26135
+ }),
26136
+ capturingClientId
26137
+ };
26138
+ }
26139
+
26140
+ function WrappedBlockPopover({
26141
  __unstablePopoverSlot,
26142
  __unstableContentRef
26143
  }) {
26144
+ const selected = (0,external_wp_data_namespaceObject.useSelect)(wrapperSelector, []);
26145
+
26146
+ if (!selected) {
26147
+ return null;
26148
+ }
26149
+
26150
+ const {
26151
+ clientId,
26152
+ rootClientId,
26153
+ name,
26154
+ isValid,
26155
+ isEmptyDefaultBlock,
26156
+ capturingClientId
26157
+ } = selected;
26158
+
26159
+ if (!name) {
26160
+ return null;
26161
+ }
26162
+
26163
+ return (0,external_wp_element_namespaceObject.createElement)(BlockPopover, {
26164
+ clientId: clientId,
26165
+ rootClientId: rootClientId,
26166
+ isValid: isValid,
26167
+ isEmptyDefaultBlock: isEmptyDefaultBlock,
26168
+ capturingClientId: capturingClientId,
26169
  __unstablePopoverSlot: __unstablePopoverSlot,
26170
  __unstableContentRef: __unstableContentRef
26171
+ });
26172
  }
26173
+ //# sourceMappingURL=block-popover.js.map
26174
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/block-tools/back-compat.js
26175
+
26176
+
26177
  /**
26178
  * WordPress dependencies
26179
  */
26186
 
26187
 
26188
 
26189
+ function BlockToolsBackCompat({
26190
+ children
26191
+ }) {
26192
  const openRef = (0,external_wp_element_namespaceObject.useContext)(InsertionPointOpenRef);
26193
+ const isDisabled = (0,external_wp_element_namespaceObject.useContext)(external_wp_components_namespaceObject.Disabled.Context); // If context is set, `BlockTools` is a parent component.
26194
+
26195
+ if (openRef || isDisabled) {
26196
+ return children;
26197
+ }
26198
+
26199
+ external_wp_deprecated_default()('wp.components.Popover.Slot name="block-toolbar"', {
26200
+ alternative: 'wp.blockEditor.BlockTools'
26201
+ });
26202
+ return (0,external_wp_element_namespaceObject.createElement)(InsertionPoint, {
26203
+ __unstablePopoverSlot: "block-toolbar"
26204
+ }, (0,external_wp_element_namespaceObject.createElement)(WrappedBlockPopover, {
26205
+ __unstablePopoverSlot: "block-toolbar"
26206
+ }), children);
26207
+ }
26208
+ //# sourceMappingURL=back-compat.js.map
26209
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inner-blocks/with-client-id.js
26210
+
26211
+
26212
+
26213
+ /**
26214
+ * WordPress dependencies
26215
+ */
26216
+
26217
+ /**
26218
+ * Internal dependencies
26219
+ */
26220
+
26221
+
26222
+ const withClientId = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => props => {
26223
  const {
26224
+ clientId
26225
+ } = useBlockEditContext();
26226
+ return (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, _extends({}, props, {
26227
+ clientId: clientId
26228
+ }));
26229
+ }, 'withClientId');
26230
+ /* harmony default export */ var with_client_id = (withClientId);
26231
+ //# sourceMappingURL=with-client-id.js.map
26232
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inner-blocks/button-block-appender.js
26233
 
 
 
26234
 
26235
+ /**
26236
+ * External dependencies
26237
+ */
26238
 
26239
+ /**
26240
+ * Internal dependencies
26241
+ */
26242
 
 
 
 
 
26243
 
 
 
26244
 
26245
+ const button_block_appender_ButtonBlockAppender = ({
26246
+ clientId,
26247
+ showSeparator,
26248
+ isFloating,
26249
+ onAddBlock,
26250
+ isToggle
26251
+ }) => {
26252
+ return (0,external_wp_element_namespaceObject.createElement)(button_block_appender, {
26253
+ className: classnames_default()({
26254
+ 'block-list-appender__toggle': isToggle
26255
+ }),
26256
+ rootClientId: clientId,
26257
+ showSeparator: showSeparator,
26258
+ isFloating: isFloating,
26259
+ onAddBlock: onAddBlock
26260
+ });
26261
+ };
26262
+ /* harmony default export */ var inner_blocks_button_block_appender = (with_client_id(button_block_appender_ButtonBlockAppender));
26263
+ //# sourceMappingURL=button-block-appender.js.map
26264
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inner-blocks/default-block-appender.js
26265
 
 
 
 
 
26266
 
26267
+ /**
26268
+ * External dependencies
26269
+ */
26270
 
26271
+ /**
26272
+ * WordPress dependencies
26273
+ */
26274
 
 
 
 
 
 
 
 
 
26275
 
 
 
 
 
26276
 
26277
+ /**
26278
+ * Internal dependencies
26279
+ */
26280
 
 
 
26281
 
 
 
 
 
 
26282
 
26283
 
26284
+ const default_block_appender_DefaultBlockAppender = ({
26285
+ clientId,
26286
+ lastBlockClientId
26287
+ }) => {
26288
+ return (0,external_wp_element_namespaceObject.createElement)(default_block_appender, {
26289
+ rootClientId: clientId,
26290
+ lastBlockClientId: lastBlockClientId
26291
+ });
26292
+ };
26293
+ /* harmony default export */ var inner_blocks_default_block_appender = ((0,external_wp_compose_namespaceObject.compose)([with_client_id, (0,external_wp_data_namespaceObject.withSelect)((select, {
26294
+ clientId
26295
+ }) => {
26296
+ const {
26297
+ getBlockOrder
26298
+ } = select(store);
26299
+ const blockClientIds = getBlockOrder(clientId);
26300
+ return {
26301
+ lastBlockClientId: (0,external_lodash_namespaceObject.last)(blockClientIds)
26302
+ };
26303
+ })])(default_block_appender_DefaultBlockAppender));
26304
+ //# sourceMappingURL=default-block-appender.js.map
26305
+ ;// CONCATENATED MODULE: external ["wp","isShallowEqual"]
26306
+ var external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"];
26307
+ var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject);
26308
+ ;// CONCATENATED MODULE: ./packages/block-editor/build-module/components/inner-blocks/use-nested-settings-update.js
26309
+ /**
26310
+ * WordPress dependencies
26311
+ */
26312
 
 
 
 
26313
 
 
26314
 
26315
+ /**
26316
+ * Internal dependencies
26317
+ */
 
26318
 
26319
 
 
 
 
26320
 
26321
+ /**
26322
+ * This hook is a side effect which updates the block-editor store when changes
26323
+ * happen to inner block settings. The given props are transformed into a
26324
+ * settings object, and if that is different from the current settings object in
26325
+ * the block-editor store, then the store is updated with the new settings which
26326
+ * came from props.
26327
+ *
26328
+ * @param {string} clientId The client ID of the block to update.
26329
+ * @param {string[]} allowedBlocks An array of block names which are permitted
26330
+ * in inner blocks.
26331
+ * @param {?Array} __experimentalDefaultBlock The default block to insert: [ blockName, { blockAttributes } ].
26332
+ * @param {?Function|boolean}