(()=>{var e={731:e=>{var t={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ: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M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},o=Object.keys(t).join("|"),n=new RegExp(o,"g"),r=new RegExp(o,"");function s(e){return t[e]}var i=function(e){return e.replace(n,s)};e.exports=i,e.exports.has=function(e){return!!e.match(r)},e.exports.remove=i}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,o),s.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=window.wp.blocks,t=window.wp.primitives,n=window.ReactJSXRuntime;var r=(0,n.jsx)(t.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,n.jsx)(t.Path,{d:"M18 4h-7c-1.1 0-2 .9-2 2v3H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-3h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h3V13c0 1.1.9 2 2 2h2.5v3zm0-4.5H11c-.3 0-.5-.2-.5-.5v-2.5H13c.3 0 .5.2.5.5v2.5zm5-.5c0 .3-.2.5-.5.5h-3V11c0-1.1-.9-2-2-2h-2.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7z"})});const s=JSON.parse('{"UU":"snow-monkey-blocks/pattern-inserter"}'),i=window.wp.blockEditor,a=window.wp.components,l=window.wp.data,c=window.wp.element,u=window.wp.i18n,d=window.lodash,p=window.wp.notices,g=(t,o)=>{const{patternCategories:n,patterns:r}=(0,l.useSelect)((e=>{const{__experimentalGetAllowedPatterns:t,getSettings:n}=e(i.store);return{patterns:t(o),patternCategories:n().__experimentalBlockPatternCategories}}),[o]),{createSuccessNotice:s}=(0,l.useDispatch)(p.store);return[r,n,(0,c.useCallback)(((o,n)=>{t((0,d.map)(n,(t=>(0,e.cloneBlock)(t))),o.name),s((0,u.sprintf)(/* translators: %s: block pattern title. */ /* translators: %s: block pattern title. */
(0,u.__)('Block pattern "%s" inserted.'),o.title),{type:"snackbar"})}),[])]};function h({selectedCategory:e,patternCategories:t,onClickCategory:o}){const r="block-editor-block-patterns-explorer__sidebar";return(0,n.jsx)("div",{className:`${r}__categories-list`,children:t.map((({name:t,label:s})=>(0,n.jsx)(a.Button,{label:s,className:`${r}__categories-list__item`,isPressed:e===t,onClick:()=>{o(t)},children:s},t)))})}function f({filterValue:e,setFilterValue:t}){return(0,n.jsx)("div",{className:"block-editor-block-patterns-explorer__search",children:(0,n.jsx)(a.SearchControl,{__nextHasNoMarginBottom:!0,onChange:t,value:e,label:(0,u.__)("Search for patterns"),placeholder:(0,u.__)("Search")})})}const x=function({selectedCategory:e,patternCategories:t,onClickCategory:o,filterValue:r,setFilterValue:s}){return(0,n.jsxs)("div",{className:"block-editor-block-patterns-explorer__sidebar",children:[(0,n.jsx)(f,{filterValue:r,setFilterValue:s}),!r&&(0,n.jsx)(h,{selectedCategory:e,patternCategories:t,onClickCategory:o})]})},m=window.wp.compose,k=window.wp.a11y;var w=(0,c.forwardRef)((({icon:e,size:t=24,...o},n)=>(0,c.cloneElement)(e,{width:t,height:t,...o,ref:n}))),C=(0,n.jsx)(t.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(t.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"})});const v=function(){return(0,n.jsxs)("div",{className:"block-editor-inserter__no-results",children:[(0,n.jsx)(w,{className:"block-editor-inserter__no-results-icon",icon:C}),(0,n.jsx)("p",{children:(0,u.__)("No results found.")})]})},_=(0,c.createContext)();(0,c.forwardRef)((function(e,t){const[o,r]=(0,c.useState)(!1);return(0,c.useEffect)((()=>{o&&(0,k.speak)((0,u.__)("Use left and right arrow keys to move through blocks"))}),[o]),(0,n.jsx)("div",{ref:t,role:"listbox","aria-orientation":"horizontal",onFocus:()=>{r(!0)},onBlur:e=>{!e.currentTarget.contains(e.relatedTarget)&&r(!1)},...e})})),(0,c.forwardRef)((function(e,t){const o=(0,c.useContext)(_);return(0,n.jsx)(a.__unstableCompositeGroup,{state:o,role:"presentation",ref:t,...e})})),(0,c.forwardRef)((function({isFirst:e,as:t,children:o,...r},s){const i=(0,c.useContext)(_);return(0,n.jsx)(a.__unstableCompositeItem,{ref:s,state:i,role:"option",focusable:!0,...r,children:r=>{const s={...r,tabIndex:e?0:r.tabIndex};return t?(0,n.jsx)(t,{...s,children:o}):"function"==typeof o?o(s):(0,n.jsx)(a.Button,{...s,children:o})}})}));const b=function({children:e}){const t=(0,a.__unstableUseCompositeState)({shift:!0,wrap:"horizontal"});return(0,n.jsx)(_.Provider,{value:t,children:e})};var j=o(731),y=o.n(j);function A(e){return e.toLowerCase()}var I=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],E=/[^A-Z0-9]+/gi;function O(e,t,o){return t instanceof RegExp?e.replace(t,o):t.reduce((function(e,t){return e.replace(t,o)}),e)}const U=e=>e.name||"",B=e=>e.title,S=e=>e.description||"",P=e=>e.keywords||[],R=e=>e.category,V=()=>null;function N(e=""){return function(e,t){void 0===t&&(t={});for(var o=t.splitRegexp,n=void 0===o?I:o,r=t.stripRegexp,s=void 0===r?E:r,i=t.transform,a=void 0===i?A:i,l=t.delimiter,c=void 0===l?" ":l,u=O(O(e,n,"$1\0$2"),s,"\0"),d=0,p=u.length;"\0"===u.charAt(d);)d++;for(;"\0"===u.charAt(p-1);)p--;return u.slice(d,p).split("\0").map(a).join(c)}(e,{splitRegexp:[/([\p{Ll}\p{Lo}\p{N}])([\p{Lu}\p{Lt}])/gu,/([\p{Lu}\p{Lt}])([\p{Lu}\p{Lt}][\p{Ll}\p{Lo}])/gu],stripRegexp:/(\p{C}|\p{P}|\p{S})+/giu}).split(" ").filter(Boolean)}function L(e=""){return(e=(e=y()(e)).replace(/^\//,"")).toLowerCase()}const z=(e="")=>N(L(e));function M(e,t,o={}){const{getName:n=U,getTitle:r=B,getDescription:s=S,getKeywords:i=P,getCategory:a=R,getCollection:l=V}=o,c=n(e),u=r(e),d=s(e),p=i(e),g=a(e),h=l(e),f=L(t),x=L(u);let m=0;if(f===x)m+=30;else if(x.startsWith(f))m+=20;else{const e=[c,u,d,...p,g,h].join(" ");0===(k=N(f),w=e,k.filter((e=>!z(w).some((t=>t.includes(e)))))).length&&(m+=10)}var k,w;return 0!==m&&c.startsWith("core/")&&(m+=c!==e.id?1:2),m}function H({filterValue:e,filteredBlockPatternsLength:t}){return e?(0,n.jsx)(a.__experimentalHeading,{level:2,lineHeight:"48px",className:"block-editor-block-patterns-explorer__search-results-count",children:(0,u.sprintf)(/* translators: %1$d: number of patterns. %2$s: block pattern search query */ /* translators: %1$d: number of patterns. %2$s: block pattern search query */
(0,u._n)('%1$d pattern found for "%1$d"','%1$d patterns found for "%2$s"',t),t,e)}):null}const F=function({filterValue:e,selectedCategory:t,patternCategories:o}){const r=(0,m.useDebounce)(k.speak,500),[s,a]=function({rootClientId:e="",insertionIndex:t,clientId:o,isAppender:n,onSelect:r,shouldFocusBlock:s=!0}){const{getSelectedBlock:a}=(0,l.useSelect)(i.store),{destinationRootClientId:d,destinationIndex:p}=(0,l.useSelect)((r=>{const{getSelectedBlockClientId:s,getBlockRootClientId:a,getBlockIndex:l,getBlockOrder:c}=r(i.store),u=s();let d,p=e;return void 0!==t?d=t:o?d=l(o):!n&&u?(p=a(u),d=l(u)+1):d=c(p).length,{destinationRootClientId:p,destinationIndex:d}}),[e,t,o,n]),{replaceBlocks:g,insertBlocks:h,showInsertionPoint:f,hideInsertionPoint:x}=(0,l.useDispatch)(i.store),m=(0,c.useCallback)(((e,t,o=!1)=>{const n=a();g(n.clientId,e,null,s||o?0:null,t);const i=Array.isArray(e)?e.length:1,l=(0,u.sprintf)(
// translators: %d: the name of the block that has been added
// translators: %d: the name of the block that has been added
(0,u._n)("%d block added.","%d blocks added.",i),i);(0,k.speak)(l),r&&r(e)}),[n,a,g,h,d,p,r,s]),w=(0,c.useCallback)((e=>{e?f(d,p):x()}),[f,x,d,p]);return[d,m,w]}({shouldFocusBlock:!0}),[d,,p]=g(a,s),h=(0,c.useMemo)((()=>o.map((e=>e.name))),[o]),f=(0,c.useMemo)((()=>e?((e=[],t="",o={})=>{if(0===z(t).length)return e;const n=e.map((e=>[e,M(e,t,o)])).filter((([,e])=>e>0));return n.sort((([,e],[,t])=>t-e)),n.map((([e])=>e))})(d,e):d.filter((e=>"uncategorized"===t?!e.categories?.length||e.categories.every((e=>!h.includes(e))):e.categories?.includes(t)))),[e,t,d]);(0,c.useEffect)((()=>{if(!e)return;const t=f.length,o=(0,u.sprintf)(/* translators: %d: number of results. */ /* translators: %d: number of results. */
(0,u._n)("%d result found.","%d results found.",t),t);r(o)}),[e,r]);const x=(0,m.useAsyncList)(f,{step:2}),w=!!f?.length;return(0,n.jsxs)("div",{className:"block-editor-block-patterns-explorer__list",children:[w&&(0,n.jsx)(H,{filterValue:e,filteredBlockPatternsLength:f.length}),(0,n.jsxs)(b,{children:[!w&&(0,n.jsx)(v,{}),w&&(0,n.jsx)(i.__experimentalBlockPatternsList,{shownPatterns:x,blockPatterns:f,onClickPattern:p,isDraggable:!1})]})]})};function T({initialCategory:e,patternCategories:t}){const[o,r]=(0,c.useState)(""),[s,i]=(0,c.useState)(e?.name);return(0,n.jsxs)("div",{className:"block-editor-block-patterns-explorer",children:[(0,n.jsx)(x,{selectedCategory:s,patternCategories:t,onClickCategory:i,filterValue:o,setFilterValue:r}),(0,n.jsx)(F,{filterValue:o,selectedCategory:s,patternCategories:t})]})}const D=function({onModalClose:e,...t}){return(0,n.jsx)(a.Modal,{title:(0,u.__)("Patterns"),closeLabel:(0,u.__)("Close"),onRequestClose:e,isFullScreen:!0,children:(0,n.jsx)(T,{...t})})};(0,e.registerBlockType)(s.UU,{icon:{foreground:"#cd162c",src:r},edit:function({clientId:e}){const[t,o]=(0,c.useState)(!1),{removeBlocks:s}=(0,l.useDispatch)("core/block-editor"),d=function(e){const[t,o]=g(void 0,null),n=(0,c.useCallback)((e=>!(!e.categories||!e.categories.length)&&e.categories.some((e=>o.some((t=>t.name===e))))),[o]);return(0,c.useMemo)((()=>{const e=o.filter((e=>t.some((t=>t.categories?.includes(e.name))))).sort((({name:e},{name:t})=>[e,t].some((e=>["featured","text"].includes(e)))?"featured"===e||"text"===t?-1:1:0));return t.some((e=>!n(e)))&&!e.find((e=>"uncategorized"===e.name))&&e.push({name:"uncategorized",label:(0,u._x)("Uncategorized")}),e}),[t,o])}(),p=0<d.length?d.slice(0,1)[0]:{};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{...(0,i.useBlockProps)(),children:(0,n.jsxs)(a.Placeholder,{icon:r,label:(0,u.__)("Insert Pattern (Beta)","snow-monkey-blocks"),children:[(0,n.jsx)("p",{children:(0,u.__)("Click on the button below to see all available patterns. Click on any pattern you wish to insert, and that pattern will be inserted into the article.","snow-monkey-blocks")}),(0,n.jsxs)("div",{children:[(0,n.jsx)(a.Button,{className:"block-editor-inserter__patterns-explore-button",onClick:()=>o(!0),variant:"secondary",children:(0,u.__)("Explore all patterns")}),(0,n.jsx)(a.Button,{variant:"tertiary",onClick:()=>s(e,!1),children:(0,u.__)("Remove this placeholder","snow-monkey-blocks")})]})]})}),t&&(0,n.jsx)(D,{initialCategory:p,patternCategories:d,onModalClose:()=>o(!1)})]})},save:function(){return null}})})()})();