Index: /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.asset.php
===================================================================
--- /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.asset.php	(revision 11163)
+++ /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.asset.php	(revision 11164)
@@ -1,1 +1,1 @@
-<?php return array('dependencies' => array('lodash', 'react', 'wp-a11y', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-data-controls', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '8bc03fb093ba7a565624f18e6f7c0a63');
+<?php return array('dependencies' => array('lodash', 'react', 'wp-a11y', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-data-controls', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '7ed4c1a2b5db2bf11f827b5b70fc5a19');
Index: /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.js
===================================================================
--- /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.js	(revision 11163)
+++ /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.js	(revision 11164)
@@ -1,10 +1,10 @@
-!function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=17)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.url},function(e,t){e.exports=window.wp.components},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wp.dataControls},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function a(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var o=typeof r;if("string"===o||"number"===o)e.push(r);else if(Array.isArray(r)){if(r.length){var c=a.apply(null,r);c&&e.push(c)}}else if("object"===o)if(r.toString===Object.prototype.toString)for(var i in r)n.call(r,i)&&r[i]&&e.push(i);else e.push(r.toString())}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(r=function(){return a}.apply(t,[]))||(e.exports=r)}()},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wp.primitives},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.exports.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.a11y},function(e,t){e.exports=window.wp.keycodes},function(e,t){e.exports=window.wp.coreData},function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.lodash},function(e,t){e.exports=window.wp.apiFetch},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"fetchPatterns",(function(){return x})),n.d(r,"loadPattern",(function(){return T})),n.d(r,"loadPatterns",(function(){return N})),n.d(r,"setErrorPatterns",(function(){return k})),n.d(r,"setCurrentQuery",(function(){return C})),n.d(r,"fetchCategories",(function(){return A})),n.d(r,"loadCategories",(function(){return I})),n.d(r,"fetchPatternFlagReasons",(function(){return L})),n.d(r,"loadPatternFlagReasons",(function(){return R})),n.d(r,"loadFavorites",(function(){return F})),n.d(r,"addFavorite",(function(){return D})),n.d(r,"removeFavorite",(function(){return M}));var a={};n.r(a),n.d(a,"getPatternsByQuery",(function(){return U})),n.d(a,"getPattern",(function(){return $})),n.d(a,"getCategories",(function(){return V})),n.d(a,"getPatternFlagReasons",(function(){return G})),n.d(a,"getFavorites",(function(){return H}));var o={};n.r(o),n.d(o,"isLoadingPatternsByQuery",(function(){return z})),n.d(o,"getPatterns",(function(){return W})),n.d(o,"getPatternsByQuery",(function(){return Y})),n.d(o,"getPatternTotalsByQuery",(function(){return X})),n.d(o,"getPatternTotalPagesByQuery",(function(){return J})),n.d(o,"getPattern",(function(){return Z})),n.d(o,"getCurrentQuery",(function(){return ee})),n.d(o,"isLoadingCategories",(function(){return te})),n.d(o,"hasLoadedCategories",(function(){return ne})),n.d(o,"getCategories",(function(){return re})),n.d(o,"getCategoryBySlug",(function(){return ae})),n.d(o,"getCategoryById",(function(){return oe})),n.d(o,"getPatternFlagReasons",(function(){return ce})),n.d(o,"isLoadingPatternFlagReasons",(function(){return ie})),n.d(o,"getFavorites",(function(){return se})),n.d(o,"isFavorite",(function(){return le})),n.d(o,"getQueryFromUrl",(function(){return ue})),n.d(o,"getUrlFromQuery",(function(){return pe}));var c=n(0),i=n(1),s=n(2),l=({name:e,url:t,avatar:n})=>Object(c.createElement)("a",{href:t,className:"pattern__author-avatar"},Object(c.createElement)("img",{alt:"",src:n}),e);const u=({className:e="",style:t,children:n})=>Object(c.createElement)("span",{className:e+" pattern-skeleton__container",style:t},n),p=e=>Object(c.createElement)("span",{className:"pattern-skeleton",style:e});var d=n(10),b=n.n(d),g=n(9),f=function(e){return Object(c.createElement)(g.SVG,b()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),Object(c.createElement)(g.Path,{d:"M11.941 21.175l-1.443-1.32c-5.124-4.67-8.508-7.75-8.508-11.53 0-3.08 2.408-5.5 5.473-5.5 1.732 0 3.394.81 4.478 2.09 1.085-1.28 2.747-2.09 4.478-2.09 3.065 0 5.473 2.42 5.473 5.5 0 3.78-3.383 6.86-8.508 11.54l-1.443 1.31z"}))};function m(e){return e*(2/3)}const h=()=>{const[e,t]=Object(c.useState)(),n=Object(c.useRef)();return Object(c.useEffect)(()=>{n.current&&t(m(n.current.clientWidth)+"px")},[n]),Object(c.createElement)("div",{ref:n},Object(c.createElement)(u,null,Object(c.createElement)(p,{height:e}),Object(c.createElement)(p,{height:"14px",marginTop:"1rem"}),Object(c.createElement)(u,{style:{flexDirection:"row",marginTop:"0.5rem",alignItems:"center"}},Object(c.createElement)(p,{height:"18px",width:"18px",marginRight:"0.5rem",borderRadius:"32px"}),Object(c.createElement)(p,{height:"12px",width:"100px",marginRight:"0.75rem"}),Object(c.createElement)(f,{width:"16px",height:"16px",fill:"#787c82",className:"pattern-favorite-button__filled"}),Object(c.createElement)(p,{height:"12px",width:"32px",marginLeft:"0.5rem"}))))};var v=({length:e=6})=>Array(e).fill().map((e,t)=>Object(c.createElement)(h,{key:t})),O=n(3);const y=e=>e.split("?")[0],j=(e,t)=>{if(!t||!e)return"";const n=Object(O.getQueryArgs)(e);if(n[t])return n[t];const r=(e=>e.replace(/^\//,""))(y(e).replace(/\/$/,"")).split("/"),a=r.indexOf(t);return-1===a?"":r[a+1]||""},_=Object(c.createContext)();function w({children:e}){const[t,n]=Object(c.useState)(Object(O.getPathAndQueryString)(window.location.href)),r=e=>{window.history.pushState("","",e),n(e)},a=()=>{n(document.location.href)};return Object(c.useEffect)(()=>(window.addEventListener("popstate",a),()=>{window.removeEventListener("popstate",a)}),[]),Object(c.createElement)(_.Provider,{value:{path:t,update:e=>{const n=(e=>(e=>{const t={};return Object.keys(e).forEach(n=>{const r=e[n];null!=r&&r.toString().length>0&&(t[n]=r)}),t})({...Object(O.getQueryArgs)(t),...Object(O.getQueryArgs)(e)}))(e),a=y(e),o=Object(O.addQueryArgs)(a,n);r(o)},replace:r}},e)}function E(){const e=Object(c.useContext)(_);if(void 0===e)throw new Error("useRoute must be used within a Provider");return e}function S({currentPage:e=1,totalPages:t}){const{path:n,update:r}=E();if(!t||t<=1)return null;const a=e>1,o=e<t,s=Object(O.getQueryString)(n)?"?"+Object(O.getQueryString)(n):"",l=n.replace(s,"").replace(/page\/\d+\/?/,""),u=function(e,t=1){const n=Array.from({length:e},(e,t)=>t+1),r=[];return e<=5?n:(r.push(...n.slice(0,2)),t>=2&&t<=e-1&&r.push(...n.slice(t-2,t+1)),r.push(...n.slice(-2)),r.filter((e,t,n)=>n.indexOf(e)===t).reduce((e,t,n,r)=>{if(0===n)return e.push(t),e;const a=Math.abs(r[n]-r[n-1]);return 0===a||(a>1&&e.push("…"),e.push(t)),e},[]))}(t,e),p=`${l}page/%s/${s}`,d=e=>1===e?`${l}${s}`:Object(i.sprintf)(p,e),b=(e,t)=>{e.preventDefault(),r(d(t))};return Object(c.createElement)("nav",{className:"pagination","aria-label":Object(i.__)("Pagination","wporg-patterns")},Object(c.createElement)("ul",{className:"pagination__list"},Object(c.createElement)("li",{className:"pagination__item pagination__item-previous-page"},a&&Object(c.createElement)("a",{className:"pagination__link",href:d(e-1),onClick:t=>b(t,e-1)},Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.__)("Previous page","wporg-patterns")),Object(c.createElement)("span",{"aria-hidden":!0},Object(i._x)("Previous","previous page link label","wporg-patterns")))),u.map((t,n)=>"…"===t?Object(c.createElement)("li",{className:"pagination__item",key:`${n}-${t}`},t):Object(c.createElement)("li",{className:"pagination__item",key:t},Object(c.createElement)("a",{className:"pagination__link",href:d(t),"aria-current":t===e?"page":void 0,onClick:e=>b(e,t)},Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.sprintf)(// translators: %s is the page number.
-Object(i.__)("Page %s","wporg-patterns"),t)),Object(c.createElement)("span",{"aria-hidden":!0},t)))),Object(c.createElement)("li",{className:"pagination__item pagination__item-next-page"},o&&Object(c.createElement)("a",{className:"pagination__link",href:d(e+1),onClick:t=>b(t,e+1)},Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.__)("Next page","wporg-patterns")),Object(c.createElement)("span",{"aria-hidden":!0},Object(i._x)("Next","next page link label","wporg-patterns"))))))}var P=n(6);function x(e){return{type:"FETCH_BLOCK_PATTERNS",query:e}}function T(e,t){return{type:"LOAD_BLOCK_PATTERN",postId:e,pattern:t}}function N(e,{page:t,patterns:n,total:r,totalPages:a}){return{type:"LOAD_BLOCK_PATTERNS",query:e,page:t,patterns:n,total:r,totalPages:a}}function k(e,{page:t,error:n}){return{type:"ERROR_BLOCK_PATTERNS",query:e,page:t,error:n}}function C(e){return{type:"SET_CURRENT_QUERY",query:e}}function A(){return{type:"FETCH_CATEGORIES"}}function I(e){return{type:"LOAD_CATEGORIES",categories:e}}function L(){return{type:"FETCH_PATTERN_FLAG_REASONS"}}function R(e){return{type:"LOAD_PATTERN_FLAG_REASONS",reasons:e}}function F(e){return{type:"LOAD_FAVORITES",patternIds:e}}function*D(e){const t=yield Object(P.apiFetch)({path:"/wporg/v1/pattern-favorites",method:"POST",data:{id:e}});if("number"==typeof t)return{type:"ADD_FAVORITE",patternId:e,count:t}}function*M(e){const t=yield Object(P.apiFetch)({path:"/wporg/v1/pattern-favorites",method:"DELETE",data:{id:e}});if("number"==typeof t)return{type:"REMOVE_FAVORITE",patternId:e,count:t}}function Q(e={}){const t=Object.keys(e).sort();let n="";for(let r=0;r<t.length;r++){const a=t[r];let o=e[a];switch(Array.isArray(o)&&(o=e[a].join()),a){case"page":case"per_page":case"_fields":break;default:n+=(n?"&":"")+Object(O.addQueryArgs)("",{[a]:o}).slice(1)}}return n}function B(e={},t){switch(t.type){case"LOAD_BLOCK_PATTERNS":{const n=(t.patterns||[]).reduce((e,t)=>({...e,[t.id]:t}),{});return{...e,...n}}case"LOAD_BLOCK_PATTERN":return{...e,[t.postId]:t.pattern};case"ADD_FAVORITE":case"REMOVE_FAVORITE":{const n={...e[t.patternId],favorite_count:t.count};return{...e,[t.patternId]:n}}default:return e}}function q(e={},t){const n=(t.patterns||[]).map(({id:e})=>e),{page:r,total:a,totalPages:o}=t;switch(t.type){case"LOAD_BLOCK_PATTERNS":{const c={...e[t.query]||{},total:a,totalPages:o};return c[r]=n,{...e,[t.query]:c}}case"ERROR_BLOCK_PATTERNS":{const n=e[t.query]||{};return n[r]=[],{...e,[t.query]:n}}default:return e}}var K=Object(s.combineReducers)({patterns:function(e={},t){return{byId:B(e.byId,t),queries:q(e.queries,t)}},categories:function(e,t){switch(t.type){case"FETCH_CATEGORIES":return null;case"LOAD_CATEGORIES":const e=(t.categories||[]).sort((e,t)=>e.name.localeCompare(t.name));return[{id:-1,slug:"",name:Object(i.__)("All","wporg-patterns"),link:wporgPatternsUrl.site},...e]}return e},currentQuery:function(e,t){switch(t.type){case"SET_CURRENT_QUERY":return t.query}return e},patternFlagReasons:function(e,t){switch(t.type){case"FETCH_PATTERN_FLAG_REASONS":return null;case"LOAD_PATTERN_FLAG_REASONS":return[...t.reasons];default:return e}},favorites:function(e=null,t){const{patternId:n}=t;switch(t.type){case"LOAD_FAVORITES":return t.patternIds;case"ADD_FAVORITE":return e.includes(n)?e:[...e,n];case"REMOVE_FAVORITE":return e.filter(e=>e!==n)}return e}});function*U(e){const t=Q(e);try{yield x(t);const n=yield Object(P.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern",{...e,locale:JSON.parse(wporgLocale)}),parse:!1}),{total:r,totalPages:a,results:o}=yield Object(P.__unstableAwaitPromise)(async function(e){try{var t,n;return{total:Number((null===(t=e.headers)||void 0===t?void 0:t.get("X-WP-Total"))||0),totalPages:Number((null===(n=e.headers)||void 0===n?void 0:n.get("X-WP-TotalPages"))||0),results:await e.json()}}catch(e){return{}}}(n));yield N(t,{page:e.page||1,patterns:o,total:r,totalPages:a})}catch(n){const r=yield Object(P.__unstableAwaitPromise)(async function(e){try{return await e.json()}catch(e){return{}}}(n));yield k(t,{page:e.page||1,error:r})}}function*$(e){try{const t=yield Object(P.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern/"+e)});yield T(e,t)}catch(e){}}function*V(){try{yield{type:"FETCH_CATEGORIES"};const e=yield Object(P.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/pattern-categories")});yield I(e)}catch(e){}}function*G(){try{yield{type:"FETCH_PATTERN_FLAG_REASONS"};const e=yield Object(P.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern-flag-reason")});yield R(e)}catch(e){}}function*H(){try{const e=yield Object(P.apiFetch)({path:"/wporg/v1/pattern-favorites"});yield F(e)}catch(e){}}function z(e,t){var n,r;const a=Q(t),o=(null==t?void 0:t.page)||1;return!Array.isArray(null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r[o])}function W(e){return Object.values(e.patterns.byId)}function Y(e,t){var n,r;const a=Q(t),o=(null==t?void 0:t.page)||1;return((null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r[o])||[]).map(t=>e.patterns.byId[t])}function X(e,t){var n,r;const a=Q(t);return(null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r.total)||0}function J(e,t){var n,r;const a=Q(t);return(null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r.totalPages)||0}function Z(e,t){return e.patterns.byId[t]||null}function ee(e){return e.currentQuery}function te(e){return null===e.categories}function ne(e){return Array.isArray(e.categories)}function re(e){return e.categories}function ae(e,t){if(!ne(e))return;const[n]=e.categories.filter(e=>e.slug===t);return n}function oe(e,t){if(ne(e))return e.categories.find(({id:e})=>t===e)}function ce(e){return e.patternFlagReasons}function ie(e){return null===e.patternFlagReasons}function se(e){return e.favorites}function le(e,t){var n;return null===(n=e.favorites)||void 0===n?void 0:n.includes(t)}function ue(e,t){const n=["categories","author","page","search"],r=Object(O.getQueryArgs)(t),a=j(t,"categories");if(a&&-1===n.indexOf(a)){const t=ae(e,a);null!=t&&t.id&&(r["pattern-categories"]=t.id)}const o=j(t,"author");o&&-1===n.indexOf(o)&&(r.author_name=o);const c=(e=>Number(j(e,"page")||1))(t);"number"==typeof c&&c>1&&(r.page=c);const i=(e=>decodeURI(j(e,"search")))(t);i.length>0&&-1===n.indexOf(i)&&(r.search=i);const s=j(t,"my-patterns");return s&&"page"!==s&&(r.status=s),r}function pe(e,t={},n=wporgPatternsUrl.site){if(n=n.replace(/\/$/,""),t.author_name&&(n+="/author/"+t.author_name,delete t.author_name),t["pattern-categories"]){const r=t["pattern-categories"],a=re(e).find(({id:e})=>r===e);null!=a&&a.slug&&(n+="/categories/"+a.slug),delete t["pattern-categories"]}return t.page&&(n+="/page/"+t.page,delete t.page),Object.keys(t).length?n+="/?"+Object(O.buildQueryString)(t):n+"/"}const de=Object(s.createReduxStore)("wporg/pattern-directory",{reducer:K,selectors:o,actions:r,controls:P.controls,resolvers:a});Object(s.register)(de);var be=function({header:e,children:t,query:n,showPagination:r=!0}){const{isLoading:a,posts:o,totalPages:i}=Object(s.useSelect)(e=>{const{getPatternTotalPagesByQuery:t,getPatternsByQuery:r,isLoadingPatternsByQuery:a}=e(de);return{isLoading:n&&a(n),posts:n?r(n):[],totalPages:n?t(n):0}});return Object(c.createElement)(c.Fragment,null,o.length?e:null,Object(c.createElement)("div",{className:"pattern-grid"},a?Object(c.createElement)(v,{length:null==n?void 0:n.per_page}):o.map(t)),r&&Object(c.createElement)(S,{totalPages:i,currentPage:null==n?void 0:n.page}))},ge=n(8),fe=n(4);function me(e){e.dir=document.dir,e.body.className="pattern-wrapper";for(const t of document.body.classList)t.startsWith("admin-color-")&&e.body.classList.add(t)}var he=Object(c.forwardRef)((function({contentRef:e,children:t,head:n,headHTML:r,bodyStyle:a="",themeSlug:o="twentytwentyone",...s},l){const[u,p]=Object(c.useState)();r+=`<link rel="stylesheet" href="https://wp-themes.com/wp-content/themes/${o}/style.css" media="all" />`,r+=`<style>\n    body {\n        display: flex;\n        min-height: 100vh;\n        align-items: center;\n        justify-content: center;\n        background-color: white;\n    }\n    .pattern-wrapper {\n        padding: 0;\n        ${a}\n    }\n    body > div {\n        width: 100%;\n        max-height: 100%;\n        pointer-events: none;\n    }\n    </style>`;const d=Object(c.useCallback)(t=>{function n(){const{contentDocument:n}=t,{readyState:a,body:o}=n;return("interactive"===a||"complete"===a)&&("function"==typeof e?e(o):e&&(e.current=o),function(e,t){e.head.innerHTML="<style>body{margin:0}</style>"+t}(n,r),me(n),function(e){const{defaultView:t}=e,{frameElement:n}=t;function r(e){const r=Object.getPrototypeOf(e).constructor.name,a=window[r],o={};for(const t in e)o[t]=e[t];if(e instanceof t.MouseEvent){const e=n.getBoundingClientRect();o.clientX+=e.left,o.clientY+=e.top}const c=new a(e.type,o);!n.dispatchEvent(c)&&e.preventDefault()}const a=["keydown","keypress","dragover"];for(const t of a)e.addEventListener(t,r)}(n),me(n),p(n),!0)}t&&(n()||t.addEventListener("load",()=>{n()}))},[]);return Object(c.createElement)("iframe",b()({title:Object(i.__)("Pattern Preview","wporg-patterns"),tabIndex:"-1"},s,{ref:Object(ge.useMergeRefs)([l,d])}),u&&Object(c.createPortal)(t,u.body),u&&Object(c.createPortal)(n,u.head))})),ve=function({html:e}){return Object(c.createElement)("div",null,Object(c.createElement)(he,{className:"pattern-preview__viewport-iframe",style:{width:"100%",height:"50vh",minHeight:"600px",overflowY:"auto"},headHTML:window.__editorStyles.html},Object(c.createElement)("div",{dangerouslySetInnerHTML:{__html:e}})))},Oe=n(5),ye=n.n(Oe);function je(e,t){return e.map((function(e,n){return e+t[n]}))}function _e(e,t){return e.map((function(e,n){return e-t[n]}))}function we(e){return Math.hypot.apply(Math,e)}function Ee(e){return Math.sign?Math.sign(e):Number(e>0)-Number(e<0)||+e}function Se(e,t,n){return 0===t||Math.abs(t)===1/0?function(e,t){return Math.pow(e,5*t)}(e,n):e*t*n/(t+n*e)}function Pe(e,t,n,r){return void 0===r&&(r=.15),0===r?function(e,t,n){return Math.max(t,Math.min(e,n))}(e,t,n):e<t?-Se(t-e,n-t,r)+t:e>n?+Se(e-n,n-t,r)+n:e}function xe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Te(){return(Te=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Ne(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function ke(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ae(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Ce(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ce(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function Ie(){}function Le(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?Ie:1===t.length?t[0]:function(){for(var e,n,r=Ae(t);!(n=r()).done;){var a=n.value;e=a.apply(this,arguments)||e}return e}}function Re(e,t){if(void 0===e){if(void 0===t)throw new Error("Must define fallback value if undefined is expected");e=t}return Array.isArray(e)?e:[e,e]}function Fe(e){if("function"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.apply(void 0,n)}return e}function De(e,t){void 0===e&&(e={});for(var n={},r=0,a=Object.entries(t);r<a.length;r++){var o=a[r],c=o[0],i=o[1];switch(typeof i){case"function":n[c]=i.call(n,e[c],c,e);break;case"object":n[c]=De(e[c],i);break;case"boolean":i&&(n[c]=e[c])}}return n}function Me(){return"undefined"!=typeof window&&"ontouchstart"in window}function Qe(e){return"pointerId"in e?null:"touchend"===e.type?e.changedTouches:e.targetTouches}function Be(e){return Array.from(Qe(e)).map((function(e){return e.identifier}))}function qe(e){return{buttons:"buttons"in e?e.buttons:0,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey}}var Ke=function(e){return e};function Ue(e,t){void 0===t&&(t=Ke);var n=Qe(e),r=n?n[0]:e;return t([r.clientX,r.clientY])}var $e=Te({},{threshold:function(e){return void 0===e&&(e=0),Re(e)},rubberband:function(e){switch(void 0===e&&(e=0),e){case!0:return Re(.15);case!1:return Re(0);default:return Re(e)}},enabled:function(e){return void 0===e&&(e=!0),e},triggerAllEvents:function(e){return void 0===e&&(e=!1),e},initial:function(e){return void 0===e&&(e=0),"function"==typeof e?e:Re(e)},transform:!0},{axis:!0,lockDirection:function(e){return void 0===e&&(e=!1),e},bounds:function(e){if(void 0===e&&(e={}),"function"==typeof e)return function(t){return $e.bounds(e(t))};var t=e,n=t.left,r=void 0===n?-1/0:n,a=t.right,o=void 0===a?1/0:a,c=t.top,i=void 0===c?-1/0:c,s=t.bottom;return[[r,o],[i,void 0===s?1/0:s]]}}),Ve="undefined"!=typeof window&&window.document&&window.document.createElement,Ge={enabled:function(e){return void 0===e&&(e=!0),e},domTarget:!0,window:function(e){function t(_x){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){return void 0===e&&(e=Ve?window:void 0),e})),eventOptions:function(e){var t=void 0===e?{}:e,n=t.passive,r=void 0===n||n,a=t.capture;return{passive:r,capture:void 0!==a&&a}},transform:!0},He=Te({},$e,{useTouch:function(e){void 0===e&&(e=!1);var t=Me(),n="undefined"!=typeof window&&"onpointerdown"in window;return!(!e||!t)||!(!t||n)},experimental_preventWindowScrollY:function(e){return void 0===e&&(e=!1),e},threshold:function(e,t,n){var r=n.filterTaps,a=void 0!==r&&r,o=n.lockDirection,c=void 0!==o&&o,i=n.axis,s=Re(e,a?3:c||(void 0===i?void 0:i)?1:0);return this.filterTaps=a,s},swipeVelocity:function(e){return void 0===e&&(e=.5),Re(e)},swipeDistance:function(e){return void 0===e&&(e=50),Re(e)},swipeDuration:function(e){return void 0===e&&(e=250),e},delay:function(e){switch(void 0===e&&(e=0),e){case!0:return 180;case!1:return 0;default:return e}}});function ze(e){var t,n=e.domTarget,r=e.eventOptions,a=e.window,o=e.enabled,c=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,["domTarget","eventOptions","window","enabled"]),i=(void 0===(t={domTarget:n,eventOptions:r,window:a,enabled:o})&&(t={}),De(t,Ge));return i.drag=function(e){return void 0===e&&(e={}),De(e,He)}(c),i}function We(e){return Te({_active:!1,_blocked:!1,_intentional:[!1,!1],_movement:[0,0],_initial:[0,0],_bounds:[[-1/0,1/0],[-1/0,1/0]],_threshold:[0,0],_lastEventType:void 0,_dragStarted:!1,_dragPreventScroll:!1,_dragIsTap:!0,_dragDelayed:!1,event:void 0,intentional:!1,values:[0,0],velocities:[0,0],delta:[0,0],movement:[0,0],offset:[0,0],lastOffset:[0,0],direction:[0,0],initial:[0,0],previous:[0,0],first:!1,last:!1,active:!1,timeStamp:0,startTime:0,elapsedTime:0,cancel:Ie,canceled:!1,memo:void 0,args:void 0},e)}function Ye(){return{shared:{hovering:!1,scrolling:!1,wheeling:!1,dragging:!1,moving:!1,pinching:!1,touches:0,buttons:0,down:!1,shiftKey:!1,altKey:!1,metaKey:!1,ctrlKey:!1,locked:!1},drag:We({_pointerId:void 0,axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0,tap:!1,swipe:[0,0]}),pinch:We({_pointerIds:[],da:[0,0],vdva:[0,0],origin:void 0,turns:0}),wheel:We({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),move:We({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),scroll:We({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0})}}var Xe=new Map,Je=function(e){return e};function Ze(e,t){return Math.abs(e)>=t&&Ee(e)*t}function et(e,t,n){var r=t[0],a=t[1],o=n[0],c=n[1],i=e[0],s=i[0],l=i[1],u=e[1],p=u[0],d=u[1];return[Pe(r,s,l,o),Pe(a,p,d,c)]}function tt(e,t,n){var r=e.state,a=t.timeStamp,o=t.type,c=r.values;return{_lastEventType:o,event:t,timeStamp:a,elapsedTime:n?0:a-r.startTime,previous:c}}function nt(e,t,n,r){var a=e.state,o=e.config,c=e.stateKey,i=e.args,s=e.transform,l=a.offset,u=n.timeStamp,p=o.initial,d=o.bounds,b=_e(s(o.threshold),s([0,0])).map(Math.abs),g=Te({},Ye()[c],{_active:!0,args:i,values:t,initial:null!=r?r:t,_threshold:b,offset:l,lastOffset:l,startTime:u});return Te({},g,{_initial:Fe(p,g),_bounds:Fe(d,g)})}var rt=function(e){var t=this;this.classes=e,this.pointerIds=new Set,this.touchIds=new Set,this.supportsTouchEvents=Me(),this.supportsGestureEvents=function(){try{return"constructor"in GestureEvent}catch(e){return!1}}(),this.bind=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];for(var a,o={},c=Ae(t.classes);!(a=c()).done;){var i=a.value;new i(t,n).addBindings(o)}var s=function(e){dt(o,e,(function(r){return t.nativeRefs[e](Te({},t.state.shared,{event:r,args:n}))}))};for(var l in t.nativeRefs)s(l);return t.config.domTarget?st(t,o):lt(t,o)},this.effect=function(){return t.config.domTarget&&t.bind(),t.clean},this.clean=function(){var e=pt(t.config),n=t.config.eventOptions;e&&gt(e,ut(t.domListeners),n),Object.values(t.timeouts).forEach(clearTimeout),function(e){var t=e.config,n=t.window,r=t.eventOptions,a=e.windowListeners;if(n){for(var o in a){gt(n,a[o],r)}e.windowListeners={}}}(t)},this.classes=e,this.state=Ye(),this.timeouts={},this.domListeners=[],this.windowListeners={}};function at(e,t){"pointerId"in t?e.pointerIds.add(t.pointerId):e.touchIds=new Set(Be(t))}function ot(e,t){"pointerId"in t?e.pointerIds.delete(t.pointerId):Be(t).forEach((function(t){return e.touchIds.delete(t)}))}function ct(e,t,n){var r=e.config,a=e.windowListeners;void 0===n&&(n=r.eventOptions),r.window&&(gt(r.window,a[t],n),delete a[t])}function it(e,t,n,r){var a=e.config,o=e.windowListeners;void 0===n&&(n=[]),void 0===r&&(r=a.eventOptions),a.window&&(gt(a.window,o[t],r),bt(a.window,o[t]=n,r))}function st(e,t){var n=e.config,r=e.domListeners,a=pt(n);if(!a)throw new Error("domTarget must be defined");var o=n.eventOptions;gt(a,ut(r),o);for(var c=0,i=Object.entries(t);c<i.length;c++){var s=i[c],l=s[0],u=s[1],p=l.slice(2).toLowerCase();r.push([p,Le.apply(void 0,u)])}bt(a,r,o)}function lt(e,t){for(var n={},r=e.config.eventOptions.capture?"Capture":"",a=0,o=Object.entries(t);a<o.length;a++){var c=o[a],i=c[0],s=c[1],l=Array.isArray(s)?s:[s];n[i+r]=Le.apply(void 0,l)}return n}function ut(e){return void 0===e&&(e=[]),e.splice(0,e.length)}function pt(e){var t=e.domTarget;return t&&"current"in t?t.current:t}function dt(e,t,n){e[t]||(e[t]=[]),e[t].push(n)}function bt(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,a=Ae(t);!(r=a()).done;){var o=r.value,c=o[0],i=o[1];e.addEventListener(c,i,n)}}function gt(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,a=Ae(t);!(r=a()).done;){var o=r.value,c=o[0],i=o[1];e.removeEventListener(c,i,n)}}function ft(){}function mt(e){"persist"in e&&"function"==typeof e.persist&&e.persist()}var ht=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="dragging",t.stateKey="drag",t.setPointerCapture=function(e){if(!t.config.useTouch&&!document.pointerLockElement){var n=e.target,r=e.pointerId;n&&"setPointerCapture"in n&&n.setPointerCapture(r),t.updateGestureState({_dragTarget:n,_dragPointerId:r})}},t.releasePointerCapture=function(){if(!t.config.useTouch&&!document.pointerLockElement){var e=t.state,n=e._dragTarget,r=e._dragPointerId;if(r&&n&&"releasePointerCapture"in n&&(!("hasPointerCapture"in n)||n.hasPointerCapture(r)))try{n.releasePointerCapture(r)}catch(e){}}},t.preventScroll=function(e){t.state._dragPreventScroll&&e.cancelable&&e.preventDefault()},t.getEventId=function(e){return t.config.useTouch?e.changedTouches[0].identifier:e.pointerId},t.isValidEvent=function(e){return t.state._pointerId===t.getEventId(e)},t.shouldPreventWindowScrollY=t.config.experimental_preventWindowScrollY&&t.controller.supportsTouchEvents,t.setUpWindowScrollDetection=function(e){mt(e),it(t.controller,t.stateKey,[["touchmove",t.preventScroll],["touchend",t.clean.bind(ke(t))],["touchcancel",t.clean.bind(ke(t))]],{passive:!1}),t.setTimeout(t.startDrag.bind(ke(t)),250,e)},t.setUpDelayedDragTrigger=function(e){t.state._dragDelayed=!0,mt(e),t.setTimeout(t.startDrag.bind(ke(t)),t.config.delay,e)},t.setStartState=function(e){var n=Ue(e,t.transform);t.updateSharedState(qe(e)),t.updateGestureState(Te({},nt(ke(t),n,e),tt(ke(t),e,!0),{_pointerId:t.getEventId(e)})),t.updateGestureState(t.getMovement(n))},t.onDragStart=function(e){at(t.controller,e),t.enabled&&!t.state._active&&(t.setStartState(e),t.setPointerCapture(e),t.shouldPreventWindowScrollY?t.setUpWindowScrollDetection(e):t.config.delay>0?t.setUpDelayedDragTrigger(e):t.startDrag(e,!0))},t.onDragChange=function(e){if(!t.state.canceled&&t.state._active&&t.isValidEvent(e)&&(t.state._lastEventType!==e.type||e.timeStamp!==t.state.timeStamp)){var n;if(document.pointerLockElement){var r=e.movementX,a=e.movementY;n=je(t.transform([r,a]),t.state.values)}else n=Ue(e,t.transform);var o=t.getKinematics(n,e);if(!t.state._dragStarted){if(t.state._dragDelayed)return void t.startDrag(e);if(!t.shouldPreventWindowScrollY)return;if(t.state._dragPreventScroll||!o.axis)return;if("x"!==o.axis)return void(t.state._active=!1);t.startDrag(e)}var c=qe(e);t.updateSharedState(c);var i=tt(ke(t),e),s=we(o._movement),l=t.state._dragIsTap;l&&s>=3&&(l=!1),t.updateGestureState(Te({},i,o,{_dragIsTap:l})),t.fireGestureHandler()}},t.onDragEnd=function(e){if(ot(t.controller,e),t.isValidEvent(e)&&(t.clean(),t.state._active)){t.state._active=!1;var n=t.state._dragIsTap,r=t.state.velocities,a=r[0],o=r[1],c=t.state.movement,i=c[0],s=c[1],l=t.state._intentional,u=l[0],p=l[1],d=t.config.swipeVelocity,b=d[0],g=d[1],f=t.config.swipeDistance,m=f[0],h=f[1],v=t.config.swipeDuration,O=Te({},tt(ke(t),e),t.getMovement(t.state.values)),y=[0,0];O.elapsedTime<v&&(!1!==u&&Math.abs(a)>b&&Math.abs(i)>m&&(y[0]=Ee(a)),!1!==p&&Math.abs(o)>g&&Math.abs(s)>h&&(y[1]=Ee(o))),t.updateSharedState({buttons:0}),t.updateGestureState(Te({},O,{tap:n,swipe:y})),t.fireGestureHandler(t.config.filterTaps&&!0===n)}},t.clean=function(){e.prototype.clean.call(ke(t)),t.state._dragStarted=!1,t.releasePointerCapture(),ct(t.controller,t.stateKey)},t.onCancel=function(){t.state.canceled||(t.updateGestureState({canceled:!0,_active:!1}),t.updateSharedState({buttons:0}),setTimeout((function(){return t.fireGestureHandler()}),0))},t.onClick=function(e){t.state._dragIsTap||e.stopPropagation()},t}Ne(t,e);var n=t.prototype;return n.startDrag=function(e,t){void 0===t&&(t=!1),this.state._active&&!this.state._dragStarted&&(t||this.setStartState(e),this.updateGestureState({_dragStarted:!0,_dragPreventScroll:!0,cancel:this.onCancel}),this.clearTimeout(),this.fireGestureHandler())},n.addBindings=function(e){this.config.useTouch?(dt(e,"onTouchStart",this.onDragStart),dt(e,"onTouchMove",this.onDragChange),dt(e,"onTouchEnd",this.onDragEnd),dt(e,"onTouchCancel",this.onDragEnd)):(dt(e,"onPointerDown",this.onDragStart),dt(e,"onPointerMove",this.onDragChange),dt(e,"onPointerUp",this.onDragEnd),dt(e,"onPointerCancel",this.onDragEnd)),this.config.filterTaps&&dt(e,this.controller.config.eventOptions.capture?"onClick":"onClickCapture",this.onClick)},t}(function(e){function t(){return e.apply(this,arguments)||this}Ne(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){return _e(e,t.initial)},n.checkIntentionality=function(e,t){if(!1===e[0]&&!1===e[1])return{_intentional:e,axis:this.state.axis};var n=t.map(Math.abs),r=n[0],a=n[1],o=this.state.axis||(r>a?"x":r<a?"y":void 0);return this.config.axis||this.config.lockDirection?o?this.config.axis&&o!==this.config.axis?{_intentional:e,_blocked:!0,axis:o}:(e["x"===o?1:0]=!1,{_intentional:e,_blocked:!1,axis:o}):{_intentional:[!1,!1],_blocked:!1,axis:o}:{_intentional:e,_blocked:!1,axis:o}},n.getKinematics=function(e,t){var n=this.getMovement(e);if(!n._blocked){var r=t.timeStamp-this.state.timeStamp;Object.assign(n,function(e,t,n){var r=we(t),a=0===r?0:1/r,o=0===n?0:1/n,c=o*r,i=t.map((function(e){return o*e})),s=t.map((function(e){return a*e}));return{velocities:i,velocity:c,distance:we(e),direction:s}}(n.movement,n.delta,r))}return n},n.mapStateValues=function(e){return{xy:e.values,vxvy:e.velocities}},t}(function(){function e(e,t){var n=this;void 0===t&&(t=[]),this.controller=e,this.args=t,this.debounced=!0,this.setTimeout=function(e,t){var r;void 0===t&&(t=140),clearTimeout(n.controller.timeouts[n.stateKey]);for(var a=arguments.length,o=new Array(a>2?a-2:0),c=2;c<a;c++)o[c-2]=arguments[c];n.controller.timeouts[n.stateKey]=(r=window).setTimeout.apply(r,[e,t].concat(o))},this.clearTimeout=function(){clearTimeout(n.controller.timeouts[n.stateKey])},this.fireGestureHandler=function(e){if(void 0===e&&(e=!1),n.state._blocked)return n.debounced||(n.state._active=!1,n.clean()),null;if(!e&&!n.state.intentional&&!n.config.triggerAllEvents)return null;if(n.state.intentional){var t=n.state.active,r=n.state._active;n.state.active=r,n.state.first=r&&!t,n.state.last=t&&!r,n.controller.state.shared[n.ingKey]=r}var a=n.controller.pointerIds.size||n.controller.touchIds.size,o=n.controller.state.shared.buttons>0||a>0,c=Te({},n.controller.state.shared,n.state,n.mapStateValues(n.state),{locked:!!document.pointerLockElement,touches:a,down:o}),i=n.handler(c);return n.state.memo=void 0!==i?i:n.state.memo,c},this.controller=e,this.args=t}var t,n,r=e.prototype;return r.updateSharedState=function(e){Object.assign(this.controller.state.shared,e)},r.updateGestureState=function(e){Object.assign(this.state,e)},r.checkIntentionality=function(e,t){return{_intentional:e,_blocked:!1}},r.getMovement=function(e){var t=this.config.rubberband,n=this.state,r=n._bounds,a=n._initial,o=n._active,c=n._intentional,i=n.lastOffset,s=n.movement,l=n._threshold,u=this.getInternalMovement(e,this.state),p=!1===c[0]?Ze(u[0],l[0]):c[0],d=!1===c[1]?Ze(u[1],l[1]):c[1],b=this.checkIntentionality([p,d],u);if(b._blocked)return Te({},b,{_movement:u,delta:[0,0]});var g=b._intentional,f=u,m=[!1!==g[0]?u[0]-g[0]:0,!1!==g[1]?u[1]-g[1]:0],h=je(m,i),v=o?t:[0,0];return m=et(r,je(m,a),v),Te({},b,{intentional:!1!==g[0]||!1!==g[1],_initial:a,_movement:f,movement:m,values:e,offset:et(r,h,v),delta:_e(m,s)})},r.clean=function(){this.clearTimeout()},t=e,(n=[{key:"config",get:function(){return this.controller.config[this.stateKey]}},{key:"enabled",get:function(){return this.controller.config.enabled&&this.config.enabled}},{key:"state",get:function(){return this.controller.state[this.stateKey]}},{key:"handler",get:function(){return this.controller.handlers[this.stateKey]}},{key:"transform",get:function(){return this.config.transform||this.controller.config.transform||Je}}])&&xe(t.prototype,n),e}()));function vt(e,t){try{return function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,a,o,c;if(Array.isArray(t)){if((r=t.length)!==n.length)return!1;for(a=r;0!=a--;)if(!e(t[a],n[a]))return!1;return!0}if("function"==typeof Map&&t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(c=t.entries();!(a=c.next()).done;)if(!n.has(a.value[0]))return!1;for(c=t.entries();!(a=c.next()).done;)if(!e(a.value[1],n.get(a.value[0])))return!1;return!0}if("function"==typeof Set&&t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(c=t.entries();!(a=c.next()).done;)if(!n.has(a.value[0]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(a=r;0!=a--;)if(!Object.prototype.hasOwnProperty.call(n,o[a]))return!1;if("undefined"!=typeof Element&&t instanceof Element)return!1;for(a=r;0!=a--;)if(!("_owner"===o[a]&&t.$$typeof||e(t[o[a]],n[o[a]])))return!1;return!0}return t!=t&&n!=n}(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}var Ot=n(12),yt=function({label:e,className:t,onDragChange:n,onDragEnd:r,direction:a="left",...o}){const i=function(e,t){void 0===t&&(t={}),Xe.set("drag",ht);var o=Object(Oe.useRef)();return o.current||(o.current=function(e,t){var n,r,a=[],o=!1;return function(){for(var c=arguments.length,i=new Array(c),s=0;s<c;s++)i[s]=arguments[s];return o&&n===this&&t(i,a)||(r=e.apply(this,i),o=!0,n=this,a=i),r}}(ze,vt)),function(e,t,n){void 0===n&&(n={});var r=function(e){var t=new Set;return e.drag&&t.add(Xe.get("drag")),e.wheel&&t.add(Xe.get("wheel")),e.scroll&&t.add(Xe.get("scroll")),e.move&&t.add(Xe.get("move")),e.pinch&&t.add(Xe.get("pinch")),e.hover&&t.add(Xe.get("hover")),t}(e),a=ye.a.useMemo((function(){return new rt(r)}),[]);return a.config=t,a.handlers=e,a.nativeRefs=n,ye.a.useEffect(a.effect,[]),a.config.domTarget?ft:a.bind}({drag:({delta:e,dragging:t})=>{const o="left"===a?-2:2;t?n(e[0]*o):r()}},o.current(t))}();return Object(c.createElement)("div",{className:"pattern-preview__drag-handle "+t},Object(c.createElement)("button",b()({className:"pattern-preview__drag-handle-button","aria-label":e},o,{onKeyDown:e=>{const{keyCode:t}=e;"left"===a&&t===Ot.LEFT||"right"===a&&t===Ot.RIGHT?n(20):("left"===a&&t===Ot.RIGHT||"right"===a&&t===Ot.LEFT)&&n(-20)},onKeyUp:r},i())))},jt=function e({blockContent:t}){const n=Object(ge.useViewportMatch)("mobile",">="),r=Object(ge.useViewportMatch)("large",">="),a=Object(ge.useViewportMatch)("wide",">="),o=Object(ge.useInstanceId)(e),[s,l]=Object(c.useState)(window.innerWidth<960?window.innerWidth:960),u=Object(c.useCallback)(e=>l(t=>t+e),[l]),p=()=>{s<280&&l(280)},d=Object(c.useMemo)(()=>n?a?[{label:Object(i.__)("Full (1200px)","wporg-patterns"),value:1200},{label:Object(i.__)("Default (960px)","wporg-patterns"),value:960},{label:Object(i.__)("Medium (480px)","wporg-patterns"),value:480},{label:Object(i.__)("Narrow (320px)","wporg-patterns"),value:320}]:r?[{label:Object(i.__)("Default (960px)","wporg-patterns"),value:960},{label:Object(i.__)("Medium (480px)","wporg-patterns"),value:480},{label:Object(i.__)("Narrow (320px)","wporg-patterns"),value:320}]:[{label:Object(i.__)("Medium (480px)","wporg-patterns"),value:480},{label:Object(i.__)("Narrow (320px)","wporg-patterns"),value:320}]:[],[n,r,a]);let b=!1;if(!d.some(e=>e.value===s)){const e=Math.max(Math.floor(s),280);b={
+!function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=17)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.url},function(e,t){e.exports=window.wp.components},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wp.dataControls},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function a(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var o=typeof r;if("string"===o||"number"===o)e.push(r);else if(Array.isArray(r)){if(r.length){var c=a.apply(null,r);c&&e.push(c)}}else if("object"===o)if(r.toString===Object.prototype.toString)for(var i in r)n.call(r,i)&&r[i]&&e.push(i);else e.push(r.toString())}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(r=function(){return a}.apply(t,[]))||(e.exports=r)}()},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wp.primitives},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.exports.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.a11y},function(e,t){e.exports=window.wp.keycodes},function(e,t){e.exports=window.wp.coreData},function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.lodash},function(e,t){e.exports=window.wp.apiFetch},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"fetchPatterns",(function(){return x})),n.d(r,"loadPattern",(function(){return N})),n.d(r,"loadPatterns",(function(){return T})),n.d(r,"setErrorPatterns",(function(){return k})),n.d(r,"setCurrentQuery",(function(){return A})),n.d(r,"fetchCategories",(function(){return C})),n.d(r,"loadCategories",(function(){return I})),n.d(r,"fetchPatternFlagReasons",(function(){return L})),n.d(r,"loadPatternFlagReasons",(function(){return R})),n.d(r,"loadFavorites",(function(){return D})),n.d(r,"addFavorite",(function(){return F})),n.d(r,"removeFavorite",(function(){return M}));var a={};n.r(a),n.d(a,"getPatternsByQuery",(function(){return U})),n.d(a,"getPattern",(function(){return $})),n.d(a,"getCategories",(function(){return V})),n.d(a,"getPatternFlagReasons",(function(){return G})),n.d(a,"getFavorites",(function(){return H}));var o={};n.r(o),n.d(o,"isLoadingPatternsByQuery",(function(){return z})),n.d(o,"getPatterns",(function(){return W})),n.d(o,"getPatternsByQuery",(function(){return Y})),n.d(o,"getPatternTotalsByQuery",(function(){return X})),n.d(o,"getPatternTotalPagesByQuery",(function(){return J})),n.d(o,"getPattern",(function(){return Z})),n.d(o,"getCurrentQuery",(function(){return ee})),n.d(o,"isLoadingCategories",(function(){return te})),n.d(o,"hasLoadedCategories",(function(){return ne})),n.d(o,"getCategories",(function(){return re})),n.d(o,"getCategoryBySlug",(function(){return ae})),n.d(o,"getCategoryById",(function(){return oe})),n.d(o,"getPatternFlagReasons",(function(){return ce})),n.d(o,"isLoadingPatternFlagReasons",(function(){return ie})),n.d(o,"getFavorites",(function(){return se})),n.d(o,"isFavorite",(function(){return le})),n.d(o,"getQueryFromUrl",(function(){return ue})),n.d(o,"getUrlFromQuery",(function(){return pe}));var c=n(0),i=n(1),s=n(2),l=({name:e,url:t,avatar:n})=>Object(c.createElement)("a",{href:t,className:"pattern__author-avatar"},Object(c.createElement)("img",{alt:"",src:n}),e);const u=({className:e="",style:t,children:n})=>Object(c.createElement)("span",{className:e+" pattern-skeleton__container",style:t},n),p=e=>Object(c.createElement)("span",{className:"pattern-skeleton",style:e});var d=n(10),b=n.n(d),g=n(9),f=function(e){return Object(c.createElement)(g.SVG,b()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),Object(c.createElement)(g.Path,{d:"M11.941 21.175l-1.443-1.32c-5.124-4.67-8.508-7.75-8.508-11.53 0-3.08 2.408-5.5 5.473-5.5 1.732 0 3.394.81 4.478 2.09 1.085-1.28 2.747-2.09 4.478-2.09 3.065 0 5.473 2.42 5.473 5.5 0 3.78-3.383 6.86-8.508 11.54l-1.443 1.31z"}))};function m(e){return e*(2/3)}const h=()=>{const[e,t]=Object(c.useState)(),n=Object(c.useRef)();return Object(c.useEffect)(()=>{n.current&&t(m(n.current.clientWidth)+"px")},[n]),Object(c.createElement)("div",{ref:n},Object(c.createElement)(u,null,Object(c.createElement)(p,{height:e}),Object(c.createElement)(p,{height:"14px",marginTop:"1rem"}),Object(c.createElement)(u,{style:{flexDirection:"row",marginTop:"0.5rem",alignItems:"center"}},Object(c.createElement)(p,{height:"18px",width:"18px",marginRight:"0.5rem",borderRadius:"32px"}),Object(c.createElement)(p,{height:"12px",width:"100px",marginRight:"0.75rem"}),Object(c.createElement)(f,{width:"16px",height:"16px",fill:"#787c82",className:"pattern-favorite-button__filled"}),Object(c.createElement)(p,{height:"12px",width:"32px",marginLeft:"0.5rem"}))))};var v=({length:e=6})=>Array(e).fill().map((e,t)=>Object(c.createElement)(h,{key:t})),O=n(3);const y=e=>e.split("?")[0],j=(e,t)=>{if(!t||!e)return"";const n=Object(O.getQueryArgs)(e);if(n[t])return n[t];const r=(e=>e.replace(/^\//,""))(y(e).replace(/\/$/,"")).split("/"),a=r.indexOf(t);return-1===a?"":r[a+1]||""},_=Object(c.createContext)();function w({children:e}){const[t,n]=Object(c.useState)(Object(O.getPathAndQueryString)(window.location.href)),r=e=>{window.history.pushState("","",e),n(e)},a=()=>{n(document.location.href)};return Object(c.useEffect)(()=>(window.addEventListener("popstate",a),()=>{window.removeEventListener("popstate",a)}),[]),Object(c.createElement)(_.Provider,{value:{path:t,update:e=>{const n=(e=>(e=>{const t={};return Object.keys(e).forEach(n=>{const r=e[n];null!=r&&r.toString().length>0&&(t[n]=r)}),t})({...Object(O.getQueryArgs)(t),...Object(O.getQueryArgs)(e)}))(e),a=y(e),o=Object(O.addQueryArgs)(a,n);r(o)},replace:r}},e)}function E(){const e=Object(c.useContext)(_);if(void 0===e)throw new Error("useRoute must be used within a Provider");return e}function S({currentPage:e=1,totalPages:t}){const{path:n,update:r}=E();if(!t||t<=1)return null;const a=e>1,o=e<t,s=Object(O.getQueryString)(n)?"?"+Object(O.getQueryString)(n):"",l=n.replace(s,"").replace(/page\/\d+\/?/,""),u=function(e,t=1){const n=Array.from({length:e},(e,t)=>t+1),r=[];return e<=5?n:(r.push(...n.slice(0,2)),t>=2&&t<=e-1&&r.push(...n.slice(t-2,t+1)),r.push(...n.slice(-2)),r.filter((e,t,n)=>n.indexOf(e)===t).reduce((e,t,n,r)=>{if(0===n)return e.push(t),e;const a=Math.abs(r[n]-r[n-1]);return 0===a||(a>1&&e.push("…"),e.push(t)),e},[]))}(t,e),p=`${l}page/%s/${s}`,d=e=>1===e?`${l}${s}`:Object(i.sprintf)(p,e),b=(e,t)=>{e.preventDefault(),r(d(t))};return Object(c.createElement)("nav",{className:"pagination","aria-label":Object(i.__)("Pagination","wporg-patterns")},Object(c.createElement)("ul",{className:"pagination__list"},Object(c.createElement)("li",{className:"pagination__item pagination__item-previous-page"},a&&Object(c.createElement)("a",{className:"pagination__link",href:d(e-1),onClick:t=>b(t,e-1)},Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.__)("Previous page","wporg-patterns")),Object(c.createElement)("span",{"aria-hidden":!0},Object(i._x)("Previous","previous page link label","wporg-patterns")))),u.map((t,n)=>"…"===t?Object(c.createElement)("li",{className:"pagination__item",key:`${n}-${t}`},t):Object(c.createElement)("li",{className:"pagination__item",key:t},Object(c.createElement)("a",{className:"pagination__link",href:d(t),"aria-current":t===e?"page":void 0,onClick:e=>b(e,t)},Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.sprintf)(// translators: %s is the page number.
+Object(i.__)("Page %s","wporg-patterns"),t)),Object(c.createElement)("span",{"aria-hidden":!0},t)))),Object(c.createElement)("li",{className:"pagination__item pagination__item-next-page"},o&&Object(c.createElement)("a",{className:"pagination__link",href:d(e+1),onClick:t=>b(t,e+1)},Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.__)("Next page","wporg-patterns")),Object(c.createElement)("span",{"aria-hidden":!0},Object(i._x)("Next","next page link label","wporg-patterns"))))))}var P=n(6);function x(e){return{type:"FETCH_BLOCK_PATTERNS",query:e}}function N(e,t){return{type:"LOAD_BLOCK_PATTERN",postId:e,pattern:t}}function T(e,{page:t,patterns:n,total:r,totalPages:a}){return{type:"LOAD_BLOCK_PATTERNS",query:e,page:t,patterns:n,total:r,totalPages:a}}function k(e,{page:t,error:n}){return{type:"ERROR_BLOCK_PATTERNS",query:e,page:t,error:n}}function A(e){return{type:"SET_CURRENT_QUERY",query:e}}function C(){return{type:"FETCH_CATEGORIES"}}function I(e){return{type:"LOAD_CATEGORIES",categories:e}}function L(){return{type:"FETCH_PATTERN_FLAG_REASONS"}}function R(e){return{type:"LOAD_PATTERN_FLAG_REASONS",reasons:e}}function D(e){return{type:"LOAD_FAVORITES",patternIds:e}}function*F(e){const t=yield Object(P.apiFetch)({path:"/wporg/v1/pattern-favorites",method:"POST",data:{id:e}});if("number"==typeof t)return{type:"ADD_FAVORITE",patternId:e,count:t}}function*M(e){const t=yield Object(P.apiFetch)({path:"/wporg/v1/pattern-favorites",method:"DELETE",data:{id:e}});if("number"==typeof t)return{type:"REMOVE_FAVORITE",patternId:e,count:t}}function Q(e={}){const t=Object.keys(e).sort();let n="";for(let r=0;r<t.length;r++){const a=t[r];let o=e[a];switch(Array.isArray(o)&&(o=e[a].join()),a){case"page":case"per_page":case"_fields":break;default:n+=(n?"&":"")+Object(O.addQueryArgs)("",{[a]:o}).slice(1)}}return n}function B(e={},t){switch(t.type){case"LOAD_BLOCK_PATTERNS":{const n=(t.patterns||[]).reduce((e,t)=>({...e,[t.id]:t}),{});return{...e,...n}}case"LOAD_BLOCK_PATTERN":return{...e,[t.postId]:t.pattern};case"ADD_FAVORITE":case"REMOVE_FAVORITE":{const n={...e[t.patternId],favorite_count:t.count};return{...e,[t.patternId]:n}}default:return e}}function q(e={},t){const n=(t.patterns||[]).map(({id:e})=>e),{page:r,total:a,totalPages:o}=t;switch(t.type){case"LOAD_BLOCK_PATTERNS":{const c={...e[t.query]||{},total:a,totalPages:o};return c[r]=n,{...e,[t.query]:c}}case"ERROR_BLOCK_PATTERNS":{const n=e[t.query]||{};return n[r]=[],{...e,[t.query]:n}}default:return e}}var K=Object(s.combineReducers)({patterns:function(e={},t){return{byId:B(e.byId,t),queries:q(e.queries,t)}},categories:function(e,t){switch(t.type){case"FETCH_CATEGORIES":return null;case"LOAD_CATEGORIES":const e=(t.categories||[]).sort((e,t)=>e.name.localeCompare(t.name));return[{id:-1,slug:"",name:Object(i.__)("All","wporg-patterns"),link:wporgPatternsUrl.site},...e]}return e},currentQuery:function(e,t){switch(t.type){case"SET_CURRENT_QUERY":return t.query}return e},patternFlagReasons:function(e,t){switch(t.type){case"FETCH_PATTERN_FLAG_REASONS":return null;case"LOAD_PATTERN_FLAG_REASONS":return[...t.reasons];default:return e}},favorites:function(e=null,t){const{patternId:n}=t;switch(t.type){case"LOAD_FAVORITES":return t.patternIds;case"ADD_FAVORITE":return e.includes(n)?e:[...e,n];case"REMOVE_FAVORITE":return e.filter(e=>e!==n)}return e}});function*U(e){const t=Q(e);try{yield x(t);const n=yield Object(P.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern",{...e,locale:JSON.parse(wporgLocale)}),parse:!1}),{total:r,totalPages:a,results:o}=yield Object(P.__unstableAwaitPromise)(async function(e){try{var t,n;return{total:Number((null===(t=e.headers)||void 0===t?void 0:t.get("X-WP-Total"))||0),totalPages:Number((null===(n=e.headers)||void 0===n?void 0:n.get("X-WP-TotalPages"))||0),results:await e.json()}}catch(e){return{}}}(n));yield T(t,{page:e.page||1,patterns:o,total:r,totalPages:a})}catch(n){const r=yield Object(P.__unstableAwaitPromise)(async function(e){try{return await e.json()}catch(e){return{}}}(n));yield k(t,{page:e.page||1,error:r})}}function*$(e){try{const t=yield Object(P.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern/"+e)});yield N(e,t)}catch(e){}}function*V(){try{yield{type:"FETCH_CATEGORIES"};const e=yield Object(P.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/pattern-categories")});yield I(e)}catch(e){}}function*G(){try{yield{type:"FETCH_PATTERN_FLAG_REASONS"};const e=yield Object(P.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern-flag-reason")});yield R(e)}catch(e){}}function*H(){try{const e=yield Object(P.apiFetch)({path:"/wporg/v1/pattern-favorites"});yield D(e)}catch(e){}}function z(e,t){var n,r;const a=Q(t),o=(null==t?void 0:t.page)||1;return!Array.isArray(null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r[o])}function W(e){return Object.values(e.patterns.byId)}function Y(e,t){var n,r;const a=Q(t),o=(null==t?void 0:t.page)||1;return((null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r[o])||[]).map(t=>e.patterns.byId[t])}function X(e,t){var n,r;const a=Q(t);return(null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r.total)||0}function J(e,t){var n,r;const a=Q(t);return(null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r.totalPages)||0}function Z(e,t){return e.patterns.byId[t]||null}function ee(e){return e.currentQuery}function te(e){return null===e.categories}function ne(e){return Array.isArray(e.categories)}function re(e){return e.categories}function ae(e,t){if(!ne(e))return;const[n]=e.categories.filter(e=>e.slug===t);return n}function oe(e,t){if(ne(e))return e.categories.find(({id:e})=>t===e)}function ce(e){return e.patternFlagReasons}function ie(e){return null===e.patternFlagReasons}function se(e){return e.favorites}function le(e,t){var n;return null===(n=e.favorites)||void 0===n?void 0:n.includes(t)}function ue(e,t){const n=["categories","author","page","search"],r=Object(O.getQueryArgs)(t),a=j(t,"categories");if(a&&-1===n.indexOf(a)){const t=ae(e,a);null!=t&&t.id&&(r["pattern-categories"]=t.id)}const o=j(t,"author");o&&-1===n.indexOf(o)&&(r.author_name=o);const c=(e=>Number(j(e,"page")||1))(t);"number"==typeof c&&c>1&&(r.page=c);const i=(e=>decodeURI(j(e,"search")))(t);i.length>0&&-1===n.indexOf(i)&&(r.search=i);const s=j(t,"my-patterns");return s&&"page"!==s&&(r.status=s),r}function pe(e,t={},n=wporgPatternsUrl.site){if(n=n.replace(/\/$/,""),t.author_name&&(n+="/author/"+t.author_name,delete t.author_name),t["pattern-categories"]){const r=t["pattern-categories"],a=re(e).find(({id:e})=>r===e);null!=a&&a.slug&&(n+="/categories/"+a.slug),delete t["pattern-categories"]}return t.page&&(n+="/page/"+t.page,delete t.page),Object.keys(t).length?n+="/?"+Object(O.buildQueryString)(t):n+"/"}const de=Object(s.createReduxStore)("wporg/pattern-directory",{reducer:K,selectors:o,actions:r,controls:P.controls,resolvers:a});Object(s.register)(de);var be=function({header:e,children:t,query:n,showPagination:r=!0}){const{isLoading:a,posts:o,totalPages:i}=Object(s.useSelect)(e=>{const{getPatternTotalPagesByQuery:t,getPatternsByQuery:r,isLoadingPatternsByQuery:a}=e(de);return{isLoading:n&&a(n),posts:n?r(n):[],totalPages:n?t(n):0}});return Object(c.createElement)(c.Fragment,null,o.length?e:null,Object(c.createElement)("div",{className:"pattern-grid"},a?Object(c.createElement)(v,{length:null==n?void 0:n.per_page}):o.map(t)),r&&Object(c.createElement)(S,{totalPages:i,currentPage:null==n?void 0:n.page}))},ge=n(8),fe=n(4);function me(e){e.dir=document.dir,e.body.className="pattern-wrapper";for(const t of document.body.classList)t.startsWith("admin-color-")&&e.body.classList.add(t)}var he=Object(c.forwardRef)((function({contentRef:e,children:t,head:n,headHTML:r,bodyStyle:a="",themeSlug:o="twentytwentyone",...s},l){const[u,p]=Object(c.useState)();r+=`<link rel="stylesheet" href="https://wp-themes.com/wp-content/themes/${o}/style.css" media="all" />`,r+=`<style>\n    body {\n        display: flex;\n        min-height: 100vh;\n        align-items: center;\n        justify-content: center;\n        background-color: white;\n    }\n    .pattern-wrapper {\n        padding: 0;\n        ${a}\n    }\n    body > div {\n        width: 100%;\n        max-height: 100%;\n        pointer-events: none;\n    }\n    </style>`;const d=Object(c.useCallback)(t=>{function n(){const{contentDocument:n}=t,{readyState:a,body:o}=n;return("interactive"===a||"complete"===a)&&("function"==typeof e?e(o):e&&(e.current=o),function(e,t){e.head.innerHTML="<style>body{margin:0}</style>"+t}(n,r),me(n),function(e){const{defaultView:t}=e,{frameElement:n}=t;function r(e){const r=Object.getPrototypeOf(e).constructor.name,a=window[r],o={};for(const t in e)o[t]=e[t];if(e instanceof t.MouseEvent){const e=n.getBoundingClientRect();o.clientX+=e.left,o.clientY+=e.top}const c=new a(e.type,o);!n.dispatchEvent(c)&&e.preventDefault()}const a=["keydown","keypress","dragover"];for(const t of a)e.addEventListener(t,r)}(n),me(n),p(n),!0)}t&&(n()||t.addEventListener("load",()=>{n()}))},[]);return Object(c.createElement)("iframe",b()({title:Object(i.__)("Pattern Preview","wporg-patterns"),tabIndex:"-1"},s,{ref:Object(ge.useMergeRefs)([l,d])}),u&&Object(c.createPortal)(t,u.body),u&&Object(c.createPortal)(n,u.head))})),ve=function({html:e}){return Object(c.createElement)("div",null,Object(c.createElement)(he,{className:"pattern-preview__viewport-iframe",style:{width:"100%",height:"50vh",minHeight:"600px",overflowY:"auto"},headHTML:window.__editorStyles.html},Object(c.createElement)("div",{dangerouslySetInnerHTML:{__html:e}})))},Oe=n(5),ye=n.n(Oe);function je(e,t){return e.map((function(e,n){return e+t[n]}))}function _e(e,t){return e.map((function(e,n){return e-t[n]}))}function we(e){return Math.hypot.apply(Math,e)}function Ee(e){return Math.sign?Math.sign(e):Number(e>0)-Number(e<0)||+e}function Se(e,t,n){return 0===t||Math.abs(t)===1/0?function(e,t){return Math.pow(e,5*t)}(e,n):e*t*n/(t+n*e)}function Pe(e,t,n,r){return void 0===r&&(r=.15),0===r?function(e,t,n){return Math.max(t,Math.min(e,n))}(e,t,n):e<t?-Se(t-e,n-t,r)+t:e>n?+Se(e-n,n-t,r)+n:e}function xe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ne(){return(Ne=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Te(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function ke(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ae(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ce(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Ae(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ae(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function Ie(){}function Le(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?Ie:1===t.length?t[0]:function(){for(var e,n,r=Ce(t);!(n=r()).done;){var a=n.value;e=a.apply(this,arguments)||e}return e}}function Re(e,t){if(void 0===e){if(void 0===t)throw new Error("Must define fallback value if undefined is expected");e=t}return Array.isArray(e)?e:[e,e]}function De(e){if("function"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.apply(void 0,n)}return e}function Fe(e,t){void 0===e&&(e={});for(var n={},r=0,a=Object.entries(t);r<a.length;r++){var o=a[r],c=o[0],i=o[1];switch(typeof i){case"function":n[c]=i.call(n,e[c],c,e);break;case"object":n[c]=Fe(e[c],i);break;case"boolean":i&&(n[c]=e[c])}}return n}function Me(){return"undefined"!=typeof window&&"ontouchstart"in window}function Qe(e){return"pointerId"in e?null:"touchend"===e.type?e.changedTouches:e.targetTouches}function Be(e){return Array.from(Qe(e)).map((function(e){return e.identifier}))}function qe(e){return{buttons:"buttons"in e?e.buttons:0,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey}}var Ke=function(e){return e};function Ue(e,t){void 0===t&&(t=Ke);var n=Qe(e),r=n?n[0]:e;return t([r.clientX,r.clientY])}var $e=Ne({},{threshold:function(e){return void 0===e&&(e=0),Re(e)},rubberband:function(e){switch(void 0===e&&(e=0),e){case!0:return Re(.15);case!1:return Re(0);default:return Re(e)}},enabled:function(e){return void 0===e&&(e=!0),e},triggerAllEvents:function(e){return void 0===e&&(e=!1),e},initial:function(e){return void 0===e&&(e=0),"function"==typeof e?e:Re(e)},transform:!0},{axis:!0,lockDirection:function(e){return void 0===e&&(e=!1),e},bounds:function(e){if(void 0===e&&(e={}),"function"==typeof e)return function(t){return $e.bounds(e(t))};var t=e,n=t.left,r=void 0===n?-1/0:n,a=t.right,o=void 0===a?1/0:a,c=t.top,i=void 0===c?-1/0:c,s=t.bottom;return[[r,o],[i,void 0===s?1/0:s]]}}),Ve="undefined"!=typeof window&&window.document&&window.document.createElement,Ge={enabled:function(e){return void 0===e&&(e=!0),e},domTarget:!0,window:function(e){function t(_x){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){return void 0===e&&(e=Ve?window:void 0),e})),eventOptions:function(e){var t=void 0===e?{}:e,n=t.passive,r=void 0===n||n,a=t.capture;return{passive:r,capture:void 0!==a&&a}},transform:!0},He=Ne({},$e,{useTouch:function(e){void 0===e&&(e=!1);var t=Me(),n="undefined"!=typeof window&&"onpointerdown"in window;return!(!e||!t)||!(!t||n)},experimental_preventWindowScrollY:function(e){return void 0===e&&(e=!1),e},threshold:function(e,t,n){var r=n.filterTaps,a=void 0!==r&&r,o=n.lockDirection,c=void 0!==o&&o,i=n.axis,s=Re(e,a?3:c||(void 0===i?void 0:i)?1:0);return this.filterTaps=a,s},swipeVelocity:function(e){return void 0===e&&(e=.5),Re(e)},swipeDistance:function(e){return void 0===e&&(e=50),Re(e)},swipeDuration:function(e){return void 0===e&&(e=250),e},delay:function(e){switch(void 0===e&&(e=0),e){case!0:return 180;case!1:return 0;default:return e}}});function ze(e){var t,n=e.domTarget,r=e.eventOptions,a=e.window,o=e.enabled,c=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,["domTarget","eventOptions","window","enabled"]),i=(void 0===(t={domTarget:n,eventOptions:r,window:a,enabled:o})&&(t={}),Fe(t,Ge));return i.drag=function(e){return void 0===e&&(e={}),Fe(e,He)}(c),i}function We(e){return Ne({_active:!1,_blocked:!1,_intentional:[!1,!1],_movement:[0,0],_initial:[0,0],_bounds:[[-1/0,1/0],[-1/0,1/0]],_threshold:[0,0],_lastEventType:void 0,_dragStarted:!1,_dragPreventScroll:!1,_dragIsTap:!0,_dragDelayed:!1,event:void 0,intentional:!1,values:[0,0],velocities:[0,0],delta:[0,0],movement:[0,0],offset:[0,0],lastOffset:[0,0],direction:[0,0],initial:[0,0],previous:[0,0],first:!1,last:!1,active:!1,timeStamp:0,startTime:0,elapsedTime:0,cancel:Ie,canceled:!1,memo:void 0,args:void 0},e)}function Ye(){return{shared:{hovering:!1,scrolling:!1,wheeling:!1,dragging:!1,moving:!1,pinching:!1,touches:0,buttons:0,down:!1,shiftKey:!1,altKey:!1,metaKey:!1,ctrlKey:!1,locked:!1},drag:We({_pointerId:void 0,axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0,tap:!1,swipe:[0,0]}),pinch:We({_pointerIds:[],da:[0,0],vdva:[0,0],origin:void 0,turns:0}),wheel:We({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),move:We({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),scroll:We({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0})}}var Xe=new Map,Je=function(e){return e};function Ze(e,t){return Math.abs(e)>=t&&Ee(e)*t}function et(e,t,n){var r=t[0],a=t[1],o=n[0],c=n[1],i=e[0],s=i[0],l=i[1],u=e[1],p=u[0],d=u[1];return[Pe(r,s,l,o),Pe(a,p,d,c)]}function tt(e,t,n){var r=e.state,a=t.timeStamp,o=t.type,c=r.values;return{_lastEventType:o,event:t,timeStamp:a,elapsedTime:n?0:a-r.startTime,previous:c}}function nt(e,t,n,r){var a=e.state,o=e.config,c=e.stateKey,i=e.args,s=e.transform,l=a.offset,u=n.timeStamp,p=o.initial,d=o.bounds,b=_e(s(o.threshold),s([0,0])).map(Math.abs),g=Ne({},Ye()[c],{_active:!0,args:i,values:t,initial:null!=r?r:t,_threshold:b,offset:l,lastOffset:l,startTime:u});return Ne({},g,{_initial:De(p,g),_bounds:De(d,g)})}var rt=function(e){var t=this;this.classes=e,this.pointerIds=new Set,this.touchIds=new Set,this.supportsTouchEvents=Me(),this.supportsGestureEvents=function(){try{return"constructor"in GestureEvent}catch(e){return!1}}(),this.bind=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];for(var a,o={},c=Ce(t.classes);!(a=c()).done;){var i=a.value;new i(t,n).addBindings(o)}var s=function(e){dt(o,e,(function(r){return t.nativeRefs[e](Ne({},t.state.shared,{event:r,args:n}))}))};for(var l in t.nativeRefs)s(l);return t.config.domTarget?st(t,o):lt(t,o)},this.effect=function(){return t.config.domTarget&&t.bind(),t.clean},this.clean=function(){var e=pt(t.config),n=t.config.eventOptions;e&&gt(e,ut(t.domListeners),n),Object.values(t.timeouts).forEach(clearTimeout),function(e){var t=e.config,n=t.window,r=t.eventOptions,a=e.windowListeners;if(n){for(var o in a){gt(n,a[o],r)}e.windowListeners={}}}(t)},this.classes=e,this.state=Ye(),this.timeouts={},this.domListeners=[],this.windowListeners={}};function at(e,t){"pointerId"in t?e.pointerIds.add(t.pointerId):e.touchIds=new Set(Be(t))}function ot(e,t){"pointerId"in t?e.pointerIds.delete(t.pointerId):Be(t).forEach((function(t){return e.touchIds.delete(t)}))}function ct(e,t,n){var r=e.config,a=e.windowListeners;void 0===n&&(n=r.eventOptions),r.window&&(gt(r.window,a[t],n),delete a[t])}function it(e,t,n,r){var a=e.config,o=e.windowListeners;void 0===n&&(n=[]),void 0===r&&(r=a.eventOptions),a.window&&(gt(a.window,o[t],r),bt(a.window,o[t]=n,r))}function st(e,t){var n=e.config,r=e.domListeners,a=pt(n);if(!a)throw new Error("domTarget must be defined");var o=n.eventOptions;gt(a,ut(r),o);for(var c=0,i=Object.entries(t);c<i.length;c++){var s=i[c],l=s[0],u=s[1],p=l.slice(2).toLowerCase();r.push([p,Le.apply(void 0,u)])}bt(a,r,o)}function lt(e,t){for(var n={},r=e.config.eventOptions.capture?"Capture":"",a=0,o=Object.entries(t);a<o.length;a++){var c=o[a],i=c[0],s=c[1],l=Array.isArray(s)?s:[s];n[i+r]=Le.apply(void 0,l)}return n}function ut(e){return void 0===e&&(e=[]),e.splice(0,e.length)}function pt(e){var t=e.domTarget;return t&&"current"in t?t.current:t}function dt(e,t,n){e[t]||(e[t]=[]),e[t].push(n)}function bt(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,a=Ce(t);!(r=a()).done;){var o=r.value,c=o[0],i=o[1];e.addEventListener(c,i,n)}}function gt(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,a=Ce(t);!(r=a()).done;){var o=r.value,c=o[0],i=o[1];e.removeEventListener(c,i,n)}}function ft(){}function mt(e){"persist"in e&&"function"==typeof e.persist&&e.persist()}var ht=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="dragging",t.stateKey="drag",t.setPointerCapture=function(e){if(!t.config.useTouch&&!document.pointerLockElement){var n=e.target,r=e.pointerId;n&&"setPointerCapture"in n&&n.setPointerCapture(r),t.updateGestureState({_dragTarget:n,_dragPointerId:r})}},t.releasePointerCapture=function(){if(!t.config.useTouch&&!document.pointerLockElement){var e=t.state,n=e._dragTarget,r=e._dragPointerId;if(r&&n&&"releasePointerCapture"in n&&(!("hasPointerCapture"in n)||n.hasPointerCapture(r)))try{n.releasePointerCapture(r)}catch(e){}}},t.preventScroll=function(e){t.state._dragPreventScroll&&e.cancelable&&e.preventDefault()},t.getEventId=function(e){return t.config.useTouch?e.changedTouches[0].identifier:e.pointerId},t.isValidEvent=function(e){return t.state._pointerId===t.getEventId(e)},t.shouldPreventWindowScrollY=t.config.experimental_preventWindowScrollY&&t.controller.supportsTouchEvents,t.setUpWindowScrollDetection=function(e){mt(e),it(t.controller,t.stateKey,[["touchmove",t.preventScroll],["touchend",t.clean.bind(ke(t))],["touchcancel",t.clean.bind(ke(t))]],{passive:!1}),t.setTimeout(t.startDrag.bind(ke(t)),250,e)},t.setUpDelayedDragTrigger=function(e){t.state._dragDelayed=!0,mt(e),t.setTimeout(t.startDrag.bind(ke(t)),t.config.delay,e)},t.setStartState=function(e){var n=Ue(e,t.transform);t.updateSharedState(qe(e)),t.updateGestureState(Ne({},nt(ke(t),n,e),tt(ke(t),e,!0),{_pointerId:t.getEventId(e)})),t.updateGestureState(t.getMovement(n))},t.onDragStart=function(e){at(t.controller,e),t.enabled&&!t.state._active&&(t.setStartState(e),t.setPointerCapture(e),t.shouldPreventWindowScrollY?t.setUpWindowScrollDetection(e):t.config.delay>0?t.setUpDelayedDragTrigger(e):t.startDrag(e,!0))},t.onDragChange=function(e){if(!t.state.canceled&&t.state._active&&t.isValidEvent(e)&&(t.state._lastEventType!==e.type||e.timeStamp!==t.state.timeStamp)){var n;if(document.pointerLockElement){var r=e.movementX,a=e.movementY;n=je(t.transform([r,a]),t.state.values)}else n=Ue(e,t.transform);var o=t.getKinematics(n,e);if(!t.state._dragStarted){if(t.state._dragDelayed)return void t.startDrag(e);if(!t.shouldPreventWindowScrollY)return;if(t.state._dragPreventScroll||!o.axis)return;if("x"!==o.axis)return void(t.state._active=!1);t.startDrag(e)}var c=qe(e);t.updateSharedState(c);var i=tt(ke(t),e),s=we(o._movement),l=t.state._dragIsTap;l&&s>=3&&(l=!1),t.updateGestureState(Ne({},i,o,{_dragIsTap:l})),t.fireGestureHandler()}},t.onDragEnd=function(e){if(ot(t.controller,e),t.isValidEvent(e)&&(t.clean(),t.state._active)){t.state._active=!1;var n=t.state._dragIsTap,r=t.state.velocities,a=r[0],o=r[1],c=t.state.movement,i=c[0],s=c[1],l=t.state._intentional,u=l[0],p=l[1],d=t.config.swipeVelocity,b=d[0],g=d[1],f=t.config.swipeDistance,m=f[0],h=f[1],v=t.config.swipeDuration,O=Ne({},tt(ke(t),e),t.getMovement(t.state.values)),y=[0,0];O.elapsedTime<v&&(!1!==u&&Math.abs(a)>b&&Math.abs(i)>m&&(y[0]=Ee(a)),!1!==p&&Math.abs(o)>g&&Math.abs(s)>h&&(y[1]=Ee(o))),t.updateSharedState({buttons:0}),t.updateGestureState(Ne({},O,{tap:n,swipe:y})),t.fireGestureHandler(t.config.filterTaps&&!0===n)}},t.clean=function(){e.prototype.clean.call(ke(t)),t.state._dragStarted=!1,t.releasePointerCapture(),ct(t.controller,t.stateKey)},t.onCancel=function(){t.state.canceled||(t.updateGestureState({canceled:!0,_active:!1}),t.updateSharedState({buttons:0}),setTimeout((function(){return t.fireGestureHandler()}),0))},t.onClick=function(e){t.state._dragIsTap||e.stopPropagation()},t}Te(t,e);var n=t.prototype;return n.startDrag=function(e,t){void 0===t&&(t=!1),this.state._active&&!this.state._dragStarted&&(t||this.setStartState(e),this.updateGestureState({_dragStarted:!0,_dragPreventScroll:!0,cancel:this.onCancel}),this.clearTimeout(),this.fireGestureHandler())},n.addBindings=function(e){this.config.useTouch?(dt(e,"onTouchStart",this.onDragStart),dt(e,"onTouchMove",this.onDragChange),dt(e,"onTouchEnd",this.onDragEnd),dt(e,"onTouchCancel",this.onDragEnd)):(dt(e,"onPointerDown",this.onDragStart),dt(e,"onPointerMove",this.onDragChange),dt(e,"onPointerUp",this.onDragEnd),dt(e,"onPointerCancel",this.onDragEnd)),this.config.filterTaps&&dt(e,this.controller.config.eventOptions.capture?"onClick":"onClickCapture",this.onClick)},t}(function(e){function t(){return e.apply(this,arguments)||this}Te(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){return _e(e,t.initial)},n.checkIntentionality=function(e,t){if(!1===e[0]&&!1===e[1])return{_intentional:e,axis:this.state.axis};var n=t.map(Math.abs),r=n[0],a=n[1],o=this.state.axis||(r>a?"x":r<a?"y":void 0);return this.config.axis||this.config.lockDirection?o?this.config.axis&&o!==this.config.axis?{_intentional:e,_blocked:!0,axis:o}:(e["x"===o?1:0]=!1,{_intentional:e,_blocked:!1,axis:o}):{_intentional:[!1,!1],_blocked:!1,axis:o}:{_intentional:e,_blocked:!1,axis:o}},n.getKinematics=function(e,t){var n=this.getMovement(e);if(!n._blocked){var r=t.timeStamp-this.state.timeStamp;Object.assign(n,function(e,t,n){var r=we(t),a=0===r?0:1/r,o=0===n?0:1/n,c=o*r,i=t.map((function(e){return o*e})),s=t.map((function(e){return a*e}));return{velocities:i,velocity:c,distance:we(e),direction:s}}(n.movement,n.delta,r))}return n},n.mapStateValues=function(e){return{xy:e.values,vxvy:e.velocities}},t}(function(){function e(e,t){var n=this;void 0===t&&(t=[]),this.controller=e,this.args=t,this.debounced=!0,this.setTimeout=function(e,t){var r;void 0===t&&(t=140),clearTimeout(n.controller.timeouts[n.stateKey]);for(var a=arguments.length,o=new Array(a>2?a-2:0),c=2;c<a;c++)o[c-2]=arguments[c];n.controller.timeouts[n.stateKey]=(r=window).setTimeout.apply(r,[e,t].concat(o))},this.clearTimeout=function(){clearTimeout(n.controller.timeouts[n.stateKey])},this.fireGestureHandler=function(e){if(void 0===e&&(e=!1),n.state._blocked)return n.debounced||(n.state._active=!1,n.clean()),null;if(!e&&!n.state.intentional&&!n.config.triggerAllEvents)return null;if(n.state.intentional){var t=n.state.active,r=n.state._active;n.state.active=r,n.state.first=r&&!t,n.state.last=t&&!r,n.controller.state.shared[n.ingKey]=r}var a=n.controller.pointerIds.size||n.controller.touchIds.size,o=n.controller.state.shared.buttons>0||a>0,c=Ne({},n.controller.state.shared,n.state,n.mapStateValues(n.state),{locked:!!document.pointerLockElement,touches:a,down:o}),i=n.handler(c);return n.state.memo=void 0!==i?i:n.state.memo,c},this.controller=e,this.args=t}var t,n,r=e.prototype;return r.updateSharedState=function(e){Object.assign(this.controller.state.shared,e)},r.updateGestureState=function(e){Object.assign(this.state,e)},r.checkIntentionality=function(e,t){return{_intentional:e,_blocked:!1}},r.getMovement=function(e){var t=this.config.rubberband,n=this.state,r=n._bounds,a=n._initial,o=n._active,c=n._intentional,i=n.lastOffset,s=n.movement,l=n._threshold,u=this.getInternalMovement(e,this.state),p=!1===c[0]?Ze(u[0],l[0]):c[0],d=!1===c[1]?Ze(u[1],l[1]):c[1],b=this.checkIntentionality([p,d],u);if(b._blocked)return Ne({},b,{_movement:u,delta:[0,0]});var g=b._intentional,f=u,m=[!1!==g[0]?u[0]-g[0]:0,!1!==g[1]?u[1]-g[1]:0],h=je(m,i),v=o?t:[0,0];return m=et(r,je(m,a),v),Ne({},b,{intentional:!1!==g[0]||!1!==g[1],_initial:a,_movement:f,movement:m,values:e,offset:et(r,h,v),delta:_e(m,s)})},r.clean=function(){this.clearTimeout()},t=e,(n=[{key:"config",get:function(){return this.controller.config[this.stateKey]}},{key:"enabled",get:function(){return this.controller.config.enabled&&this.config.enabled}},{key:"state",get:function(){return this.controller.state[this.stateKey]}},{key:"handler",get:function(){return this.controller.handlers[this.stateKey]}},{key:"transform",get:function(){return this.config.transform||this.controller.config.transform||Je}}])&&xe(t.prototype,n),e}()));function vt(e,t){try{return function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,a,o,c;if(Array.isArray(t)){if((r=t.length)!==n.length)return!1;for(a=r;0!=a--;)if(!e(t[a],n[a]))return!1;return!0}if("function"==typeof Map&&t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(c=t.entries();!(a=c.next()).done;)if(!n.has(a.value[0]))return!1;for(c=t.entries();!(a=c.next()).done;)if(!e(a.value[1],n.get(a.value[0])))return!1;return!0}if("function"==typeof Set&&t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(c=t.entries();!(a=c.next()).done;)if(!n.has(a.value[0]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(a=r;0!=a--;)if(!Object.prototype.hasOwnProperty.call(n,o[a]))return!1;if("undefined"!=typeof Element&&t instanceof Element)return!1;for(a=r;0!=a--;)if(!("_owner"===o[a]&&t.$$typeof||e(t[o[a]],n[o[a]])))return!1;return!0}return t!=t&&n!=n}(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}var Ot=n(12),yt=function({label:e,className:t,onDragChange:n,onDragEnd:r,direction:a="left",...o}){const i=function(e,t){void 0===t&&(t={}),Xe.set("drag",ht);var o=Object(Oe.useRef)();return o.current||(o.current=function(e,t){var n,r,a=[],o=!1;return function(){for(var c=arguments.length,i=new Array(c),s=0;s<c;s++)i[s]=arguments[s];return o&&n===this&&t(i,a)||(r=e.apply(this,i),o=!0,n=this,a=i),r}}(ze,vt)),function(e,t,n){void 0===n&&(n={});var r=function(e){var t=new Set;return e.drag&&t.add(Xe.get("drag")),e.wheel&&t.add(Xe.get("wheel")),e.scroll&&t.add(Xe.get("scroll")),e.move&&t.add(Xe.get("move")),e.pinch&&t.add(Xe.get("pinch")),e.hover&&t.add(Xe.get("hover")),t}(e),a=ye.a.useMemo((function(){return new rt(r)}),[]);return a.config=t,a.handlers=e,a.nativeRefs=n,ye.a.useEffect(a.effect,[]),a.config.domTarget?ft:a.bind}({drag:({delta:e,dragging:t})=>{const o="left"===a?-2:2;t?n(e[0]*o):r()}},o.current(t))}();return Object(c.createElement)("div",{className:"pattern-preview__drag-handle "+t},Object(c.createElement)("button",b()({className:"pattern-preview__drag-handle-button","aria-label":e},o,{onKeyDown:e=>{const{keyCode:t}=e;"left"===a&&t===Ot.LEFT||"right"===a&&t===Ot.RIGHT?n(20):("left"===a&&t===Ot.RIGHT||"right"===a&&t===Ot.LEFT)&&n(-20)},onKeyUp:r},i())))},jt=function e({blockContent:t}){const n=Object(ge.useViewportMatch)("mobile",">="),r=Object(ge.useViewportMatch)("large",">="),a=Object(ge.useViewportMatch)("wide",">="),o=Object(ge.useInstanceId)(e),[s,l]=Object(c.useState)(window.innerWidth<960?window.innerWidth:960),u=Object(c.useCallback)(e=>l(t=>t+e),[l]),p=()=>{s<280&&l(280)},d=Object(c.useMemo)(()=>n?a?[{label:Object(i.__)("Full (1200px)","wporg-patterns"),value:1200},{label:Object(i.__)("Default (960px)","wporg-patterns"),value:960},{label:Object(i.__)("Medium (480px)","wporg-patterns"),value:480},{label:Object(i.__)("Narrow (320px)","wporg-patterns"),value:320}]:r?[{label:Object(i.__)("Default (960px)","wporg-patterns"),value:960},{label:Object(i.__)("Medium (480px)","wporg-patterns"),value:480},{label:Object(i.__)("Narrow (320px)","wporg-patterns"),value:320}]:[{label:Object(i.__)("Medium (480px)","wporg-patterns"),value:480},{label:Object(i.__)("Narrow (320px)","wporg-patterns"),value:320}]:[],[n,r,a]);let b=!1;if(!d.some(e=>e.value===s)){const e=Math.max(Math.floor(s),280);b={
 /* translators: %s is the width in pixels, ex 600. */
-label:Object(i.sprintf)(Object(i.__)("Current (%spx)","wporg-patterns"),e),value:e}}return Object(c.createElement)(c.Fragment,null,Object(c.createElement)("div",{className:"pattern-preview__size-control"},n&&Object(c.createElement)(fe.SelectControl,{hideLabelFromVision:!0,label:Object(i.__)("Preview Width","wporg-patterns"),value:s,options:b?[b,...d]:d,onChange:e=>l(Number(e))})),Object(c.createElement)("div",{className:"pattern-preview__viewport",style:{width:s+40}},Object(c.createElement)(yt,{label:Object(i.__)("Drag to resize","wporg-patterns"),className:"is-left",onDragChange:u,onDragEnd:p,direction:"left","aria-describedby":"pattern-preview__resize-help-"+o}),Object(c.createElement)(ve,{html:t}),Object(c.createElement)(yt,{label:Object(i.__)("Drag to resize","wporg-patterns"),className:"is-right",onDragChange:u,onDragEnd:p,direction:"right","aria-describedby":"pattern-preview__resize-help-"+o}),Object(c.createElement)(fe.VisuallyHidden,{id:"pattern-preview__resize-help-"+o,className:"pattern-preview__resize-help"},Object(i.__)("Use left and right arrow keys to resize the preview.","wporg-patterns"))))},_t=n(7),wt=n.n(_t),Et=n(15),St=n(11),Pt=({isSmall:e=!1,onSuccess:t=Et.noop,content:n})=>{const[r,a]=Object(c.useState)(!1);if(!n){const e=document.getElementById("block-data");n=JSON.parse(decodeURIComponent(e.value))}Object(c.useEffect)(()=>{if(!r)return;Object(St.speak)(Object(i.__)("Copied pattern to clipboard.","wporg-patterns"));const e=setTimeout(()=>a(!1),2e4);return()=>{clearTimeout(e)}},[r]);let o=Object(i.__)("Copy Pattern","wporg-patterns");e&&(o=r?Object(i.__)("Copied","wporg-patterns"):Object(i.__)("Copy","wporg-patterns"));const s=wt()({"pattern-copy-button":!0,"is-small-label":e});return Object(c.createElement)(fe.Button,{className:s,isPrimary:!0,onClick:({target:e})=>{const r=(e=>{const t=document.createElement("textarea");t.setAttribute("readonly",""),t.setAttribute("aria-hidden","true"),t.style.position="absolute",t.style.left="-9999px",t.value=e,document.body.appendChild(t),t.select();const n=document.execCommand("copy");return document.body.removeChild(t),n})(n);a(r),e.focus(),r&&t()}},o)},xt=n(13),Tt=function(e){return Object(c.createElement)(g.SVG,b()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),Object(c.createElement)(g.Path,{d:"M12 4.915c1.09-1.28 2.76-2.09 4.5-2.09 3.08 0 5.5 2.42 5.5 5.5 0 3.777-3.394 6.855-8.537 11.518l-.013.012-1.45 1.32-1.45-1.31-.04-.036C5.384 15.17 2 12.095 2 8.325c0-3.08 2.42-5.5 5.5-5.5 1.74 0 3.41.81 4.5 2.09zm0 13.56l.1-.1c4.76-4.31 7.9-7.16 7.9-10.05 0-2-1.5-3.5-3.5-3.5-1.54 0-3.04.99-3.56 2.36h-1.87c-.53-1.37-2.03-2.36-3.57-2.36-2 0-3.5 1.5-3.5 3.5 0 2.89 3.14 5.74 7.9 10.05l.1.1z"}))},Nt=({showLabel:e=!0,patternId:t})=>{const{hasPermission:n,isFavorite:r}=Object(s.useSelect)(e=>(e(de).getFavorites(),{hasPermission:!!e(xt.store).canUser("create","../../wporg/v1/pattern-favorites"),isFavorite:e(de).isFavorite(t)})),{addFavorite:a,removeFavorite:o}=Object(s.useDispatch)(de),l=Object(c.useCallback)(()=>{r?o(t):a(t)},[r]);if(!n)return null;const u=wt()("button button-link pattern-favorite-button",{"is-favorited":r,"has-label":e}),p=wt()({"screen-reader-text":!e});return Object(c.createElement)("button",{className:u,onClick:l},Object(c.createElement)(f,{className:"pattern-favorite-button__filled"}),Object(c.createElement)(Tt,{className:"pattern-favorite-button__outline"}),Object(c.createElement)("span",{className:p},r?Object(i.__)("Remove from favorites","wporg-patterns"):Object(i.__)("Add to favorites","wporg-patterns")))},kt=({onClick:e})=>Object(c.createElement)(fe.Notice,{className:"pattern-actions__notice",status:"success",isDismissible:!1,actions:[{label:Object(i.__)("Learn More","wporg-patterns"),onClick:e,variant:"secondary"}]},Object(c.createElement)("div",null,Object(c.createElement)("b",null,Object(i.__)("Pattern copied!","wporg-patterns")),Object(i.__)(" Now you can paste it into any WordPress post or page.","wporg-patterns")));const Ct=()=>Object(c.createElement)("div",{style:{height:"220px"}},Object(c.createElement)("img",{src:wporgPatternsUrl.assets+"/images/copy-paste-demo.gif",alt:Object(i.__)("GIF of copy and pasting.","wporg-patterns")}));var At=({onFinish:e})=>Object(c.createElement)(fe.Animate,{type:"appear",options:{origin:"bottom"}},({className:t})=>Object(c.createElement)(fe.Guide,{className:"pattern-actions__guide "+t,onFinish:e,finishButtonText:Object(i.__)("Close","wporg-patterns"),pages:[{image:Object(c.createElement)(Ct,null),content:Object(c.createElement)("div",{className:"pattern-actions__guide-content"},Object(c.createElement)("h3",{className:"pattern-actions__guide-title"},Object(i.__)("How to use patterns on your WordPress site.","wporg-patterns")),Object(c.createElement)("p",null,Object(i.__)("Patterns are really just text. And, just like you can copy and paste text, you can copy and paste patterns. It’s really easy!","wporg-patterns")),Object(c.createElement)("ol",null,Object(c.createElement)("li",null,Object(c.createElement)("p",null,Object(i.__)("Open any post or page in the WordPress block editor.","wporg-patterns"))),Object(c.createElement)("li",null,Object(c.createElement)("p",null,Object(i.__)("Place your cursor where you want to add the pattern.","wporg-patterns"))),Object(c.createElement)("li",null,Object(c.createElement)("p",null,Object(c.createInterpolateElement)(Object(i.__)("Paste the contents of your clipboard by holding down <kbd>ctrl</kbd> control (Windows) or <kbd>⌘</kbd> command (Mac) and pressing the <kbd>v</kbd> key, or right-clicking and choose “Paste” from the menu.","wporg-patterns"),{kbd:Object(c.createElement)("kbd",{className:"pattern-actions__guide-shortcut"})})))))}]})),It=({postId:e})=>{const[t,n]=Object(c.useState)(!1),[r,a]=Object(c.useState)(!1);return Object(c.createElement)("div",{className:"pattern-actions"},Object(c.createElement)("div",{className:"pattern-actions__container"},Object(c.createElement)(Pt,{onSuccess:()=>n(!0)}),Object(c.createElement)(Nt,{patternId:e}),t&&Object(c.createElement)(kt,{onClick:()=>a(!0)}),r&&Object(c.createElement)(At,{onFinish:()=>a(!1)})))},Lt=n(14),Rt=function({className:e,html:t}){const n=Object(c.useRef)(),[r,a]=Object(c.useState)("100%"),[o,s]=Object(c.useState)(.3125);Object(c.useEffect)(()=>{const e=()=>{try{a(m(n.current.clientWidth)),s(n.current.clientWidth/800)}catch(e){}};return e(),window.addEventListener("resize",e),()=>{window.addEventListener("resize",e)}},[]);const l={border:"none",width:"800px",maxWidth:"none",height:m(800)+"px",transform:`scale(${o})`,transformOrigin:Object(i.isRTL)()?"top right":"top left",pointerEvents:"none"};return Object(c.createElement)("div",{className:e,ref:n,style:{height:r},tabIndex:"-1"},Object(c.createElement)(he,{className:"pattern-grid__preview-iframe",style:l,bodyStyle:"overflow: hidden;",headHTML:window.__editorStyles.html},Object(c.createElement)("div",{dangerouslySetInnerHTML:{__html:t}})))},Ft=({className:e,label:t,patternId:n})=>{const{hasPermission:r,isFavorite:a}=Object(s.useSelect)(e=>(e(de).getFavorites(),{hasPermission:!!e(xt.store).canUser("create","../../wporg/v1/pattern-favorites"),isFavorite:e(de).isFavorite(n)})),{addFavorite:o,removeFavorite:i}=Object(s.useDispatch)(de),l=Object(c.useCallback)(()=>{a?i(n):o(n)},[a]),u=wt()(e,"pattern-favorite-button-small",{button:r,"button-link":r,"is-favorited":a});return r?Object(c.createElement)("button",{className:u,onClick:l},Object(c.createElement)(f,{className:"pattern-favorite-button__filled"}),Object(c.createElement)("span",null,t)):Object(c.createElement)("span",{className:u},Object(c.createElement)(f,{className:"pattern-favorite-button__filled"}),Object(c.createElement)("span",null,t))},Dt=function({pattern:e,showAvatar:t}){const n=function(e){switch(e.status){case"pending":return Object(i.__)("Pending","wporg-patterns");case"draft":return Object(i.__)("Draft","wporg-patterns");case"declined":return Object(i.__)("Declined","wporg-patterns")}return""}(e);return Object(c.createElement)("div",{className:"pattern-grid__pattern"},Object(c.createElement)("div",{className:"pattern-grid__pattern-frame"},Object(c.createElement)("a",{href:e.link,rel:"bookmark"},Object(c.createElement)("span",{className:"screen-reader-text"},Object(Lt.decodeEntities)(e.title.rendered)),Object(c.createElement)(fe.Disabled,null,Object(c.createElement)(Rt,{className:"pattern-grid__preview",html:e.content.rendered}))),n?Object(c.createElement)("div",{className:"pattern-grid__status is-"+e.status},Object(c.createElement)("span",null,n)):null,Object(c.createElement)("span",{className:"pattern-grid__actions"},Object(c.createElement)(Nt,{showLabel:!1,patternId:e.id}),Object(c.createElement)(Pt,{isSmall:!0,content:e.pattern_content}))),Object(c.createElement)("h2",{className:"pattern-grid__title"},Object(c.createElement)("a",{href:e.link},Object(Lt.decodeEntities)(e.title.rendered))),Object(c.createElement)("p",{className:"pattern-grid__meta"},t&&e.author_meta?Object(c.createElement)("a",{href:e.author_meta.url,className:"pattern-grid__author-avatar"},Object(c.createElement)("img",{alt:"",src:e.author_meta.avatar}),e.author_meta.name):null,e.favorite_count>0?Object(c.createElement)(Ft,{className:"pattern-grid__favorite-count",patternId:e.id,label:Object(c.createElement)(c.Fragment,null,Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.sprintf)(
+label:Object(i.sprintf)(Object(i.__)("Current (%spx)","wporg-patterns"),e),value:e}}return Object(c.createElement)(c.Fragment,null,Object(c.createElement)("div",{className:"pattern-preview__size-control"},n&&Object(c.createElement)(fe.SelectControl,{hideLabelFromVision:!0,label:Object(i.__)("Preview Width","wporg-patterns"),value:s,options:b?[b,...d]:d,onChange:e=>l(Number(e))})),Object(c.createElement)("div",{className:"pattern-preview__viewport",style:{width:s+40}},Object(c.createElement)(yt,{label:Object(i.__)("Drag to resize","wporg-patterns"),className:"is-left",onDragChange:u,onDragEnd:p,direction:"left","aria-describedby":"pattern-preview__resize-help-"+o}),Object(c.createElement)(ve,{html:t}),Object(c.createElement)(yt,{label:Object(i.__)("Drag to resize","wporg-patterns"),className:"is-right",onDragChange:u,onDragEnd:p,direction:"right","aria-describedby":"pattern-preview__resize-help-"+o}),Object(c.createElement)(fe.VisuallyHidden,{id:"pattern-preview__resize-help-"+o,className:"pattern-preview__resize-help"},Object(i.__)("Use left and right arrow keys to resize the preview.","wporg-patterns"))))},_t=n(7),wt=n.n(_t),Et=n(15),St=n(11),Pt=({isSmall:e=!1,onSuccess:t=Et.noop,content:n})=>{const[r,a]=Object(c.useState)(!1);if(!n){const e=document.getElementById("block-data");n=JSON.parse(decodeURIComponent(e.value))}Object(c.useEffect)(()=>{if(!r)return;Object(St.speak)(Object(i.__)("Copied pattern to clipboard.","wporg-patterns"));const e=setTimeout(()=>a(!1),2e4);return()=>{clearTimeout(e)}},[r]);let o=Object(i.__)("Copy Pattern","wporg-patterns");e&&(o=r?Object(i.__)("Copied","wporg-patterns"):Object(i.__)("Copy","wporg-patterns"));const s=wt()({"pattern-copy-button":!0,"is-small-label":e});return Object(c.createElement)(fe.Button,{className:s,isPrimary:!0,onClick:({target:e})=>{const r=(e=>{const t=document.createElement("textarea");t.setAttribute("readonly",""),t.setAttribute("aria-hidden","true"),t.style.position="absolute",t.style.left="-9999px",t.value=e,document.body.appendChild(t),t.select();const n=document.execCommand("copy");return document.body.removeChild(t),n})(n);a(r),e.focus(),r&&t()}},o)},xt=n(13),Nt=function(e){return Object(c.createElement)(g.SVG,b()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),Object(c.createElement)(g.Path,{d:"M12 4.915c1.09-1.28 2.76-2.09 4.5-2.09 3.08 0 5.5 2.42 5.5 5.5 0 3.777-3.394 6.855-8.537 11.518l-.013.012-1.45 1.32-1.45-1.31-.04-.036C5.384 15.17 2 12.095 2 8.325c0-3.08 2.42-5.5 5.5-5.5 1.74 0 3.41.81 4.5 2.09zm0 13.56l.1-.1c4.76-4.31 7.9-7.16 7.9-10.05 0-2-1.5-3.5-3.5-3.5-1.54 0-3.04.99-3.56 2.36h-1.87c-.53-1.37-2.03-2.36-3.57-2.36-2 0-3.5 1.5-3.5 3.5 0 2.89 3.14 5.74 7.9 10.05l.1.1z"}))},Tt=({showLabel:e=!0,patternId:t})=>{const{hasPermission:n,isFavorite:r}=Object(s.useSelect)(e=>(e(de).getFavorites(),{hasPermission:!!e(xt.store).canUser("create","../../wporg/v1/pattern-favorites"),isFavorite:e(de).isFavorite(t)})),{addFavorite:a,removeFavorite:o}=Object(s.useDispatch)(de),l=Object(c.useCallback)(()=>{r?o(t):a(t)},[r]);if(!n)return null;const u=wt()("button button-link pattern-favorite-button",{"is-favorited":r,"has-label":e}),p=wt()({"screen-reader-text":!e});return Object(c.createElement)("button",{className:u,onClick:l},Object(c.createElement)(f,{className:"pattern-favorite-button__filled"}),Object(c.createElement)(Nt,{className:"pattern-favorite-button__outline"}),Object(c.createElement)("span",{className:p},r?Object(i.__)("Remove from favorites","wporg-patterns"):Object(i.__)("Add to favorites","wporg-patterns")))},kt=({onClick:e})=>Object(c.createElement)(fe.Notice,{className:"pattern-actions__notice",status:"success",isDismissible:!1,actions:[{label:Object(i.__)("Learn More","wporg-patterns"),onClick:e,variant:"secondary"}]},Object(c.createElement)("div",null,Object(c.createElement)("b",null,Object(i.__)("Pattern copied!","wporg-patterns")),Object(i.__)(" Now you can paste it into any WordPress post or page.","wporg-patterns")));const At=()=>Object(c.createElement)("div",{style:{height:"220px"}},Object(c.createElement)("img",{src:wporgPatternsUrl.assets+"/images/copy-paste-demo.gif",alt:Object(i.__)("GIF of copy and pasting.","wporg-patterns")}));var Ct=({onFinish:e})=>Object(c.createElement)(fe.Animate,{type:"appear",options:{origin:"bottom"}},({className:t})=>Object(c.createElement)(fe.Guide,{className:"pattern-actions__guide "+t,onFinish:e,finishButtonText:Object(i.__)("Close","wporg-patterns"),pages:[{image:Object(c.createElement)(At,null),content:Object(c.createElement)("div",{className:"pattern-actions__guide-content"},Object(c.createElement)("h3",{className:"pattern-actions__guide-title"},Object(i.__)("How to use patterns on your WordPress site.","wporg-patterns")),Object(c.createElement)("p",null,Object(i.__)("Patterns are really just text. And, just like you can copy and paste text, you can copy and paste patterns. It’s really easy!","wporg-patterns")),Object(c.createElement)("ol",null,Object(c.createElement)("li",null,Object(c.createElement)("p",null,Object(i.__)("Open any post or page in the WordPress block editor.","wporg-patterns"))),Object(c.createElement)("li",null,Object(c.createElement)("p",null,Object(i.__)("Place your cursor where you want to add the pattern.","wporg-patterns"))),Object(c.createElement)("li",null,Object(c.createElement)("p",null,Object(c.createInterpolateElement)(Object(i.__)("Paste the contents of your clipboard by holding down <kbd>ctrl</kbd> control (Windows) or <kbd>⌘</kbd> command (Mac) and pressing the <kbd>v</kbd> key, or right-clicking and choose “Paste” from the menu.","wporg-patterns"),{kbd:Object(c.createElement)("kbd",{className:"pattern-actions__guide-shortcut"})})))))}]})),It=({postId:e})=>{const[t,n]=Object(c.useState)(!1),[r,a]=Object(c.useState)(!1);return Object(c.createElement)("div",{className:"pattern-actions"},Object(c.createElement)("div",{className:"pattern-actions__container"},Object(c.createElement)(Pt,{onSuccess:()=>n(!0)}),Object(c.createElement)(Tt,{patternId:e}),t&&Object(c.createElement)(kt,{onClick:()=>a(!0)}),r&&Object(c.createElement)(Ct,{onFinish:()=>a(!1)})))},Lt=n(14),Rt=function({className:e,html:t}){const n=Object(c.useRef)(),[r,a]=Object(c.useState)("100%"),[o,s]=Object(c.useState)(.3125);Object(c.useEffect)(()=>{const e=()=>{try{a(m(n.current.clientWidth)),s(n.current.clientWidth/800)}catch(e){}};return e(),window.addEventListener("resize",e),()=>{window.addEventListener("resize",e)}},[]);const l={border:"none",width:"800px",maxWidth:"none",height:m(800)+"px",transform:`scale(${o})`,transformOrigin:Object(i.isRTL)()?"top right":"top left",pointerEvents:"none"};return Object(c.createElement)("div",{className:e,ref:n,style:{height:r},tabIndex:"-1"},Object(c.createElement)(he,{className:"pattern-grid__preview-iframe",style:l,bodyStyle:"overflow: hidden;",headHTML:window.__editorStyles.html},Object(c.createElement)("div",{dangerouslySetInnerHTML:{__html:t}})))},Dt=({className:e,label:t,patternId:n})=>{const{hasPermission:r,isFavorite:a}=Object(s.useSelect)(e=>(e(de).getFavorites(),{hasPermission:!!e(xt.store).canUser("create","../../wporg/v1/pattern-favorites"),isFavorite:e(de).isFavorite(n)})),{addFavorite:o,removeFavorite:i}=Object(s.useDispatch)(de),l=Object(c.useCallback)(()=>{a?i(n):o(n)},[a]),u=wt()(e,"pattern-favorite-button-small",{button:r,"button-link":r,"is-favorited":a});return r?Object(c.createElement)("button",{className:u,onClick:l},Object(c.createElement)(f,{className:"pattern-favorite-button__filled"}),Object(c.createElement)("span",null,t)):Object(c.createElement)("span",{className:u},Object(c.createElement)(f,{className:"pattern-favorite-button__filled"}),Object(c.createElement)("span",null,t))},Ft=function({pattern:e,showAvatar:t}){const n=function(e){switch(e.status){case"pending":return Object(i.__)("Pending","wporg-patterns");case"draft":return Object(i.__)("Draft","wporg-patterns");case"declined":return Object(i.__)("Declined","wporg-patterns")}return""}(e);return Object(c.createElement)("div",{className:"pattern-grid__pattern"},Object(c.createElement)("div",{className:"pattern-grid__pattern-frame"},Object(c.createElement)("a",{href:e.link,rel:"bookmark"},Object(c.createElement)("span",{className:"screen-reader-text"},Object(Lt.decodeEntities)(e.title.rendered)),Object(c.createElement)(fe.Disabled,null,Object(c.createElement)(Rt,{className:"pattern-grid__preview",html:e.content.rendered}))),n?Object(c.createElement)("div",{className:"pattern-grid__status is-"+e.status},Object(c.createElement)("span",null,n)):null,Object(c.createElement)("span",{className:"pattern-grid__actions"},Object(c.createElement)(Tt,{showLabel:!1,patternId:e.id}),Object(c.createElement)(Pt,{isSmall:!0,content:e.pattern_content}))),Object(c.createElement)("h2",{className:"pattern-grid__title"},Object(c.createElement)("a",{href:e.link},Object(Lt.decodeEntities)(e.title.rendered))),Object(c.createElement)("p",{className:"pattern-grid__meta"},t&&e.author_meta?Object(c.createElement)("a",{href:e.author_meta.url,className:"pattern-grid__author-avatar"},Object(c.createElement)("img",{alt:"",src:e.author_meta.avatar}),e.author_meta.name):null,e.favorite_count>0?Object(c.createElement)(Dt,{className:"pattern-grid__favorite-count",patternId:e.id,label:Object(c.createElement)(c.Fragment,null,Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.sprintf)(
 /* translators: %s is the favorite count for a pattern. */
 Object(i._n)("Favorited %s times","Favorited %s times",e.favorite_count,"wporg-patterns"),e.favorite_count)),Object(c.createElement)("span",{"aria-hidden":!0},e.favorite_count))}):null))},Mt=function({icon:e,size:t=24,...n}){return Object(c.cloneElement)(e,{width:t,height:t,...n})},Qt=Object(c.createElement)(g.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(g.Path,{d:"M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"})),Bt=n(16),qt=n.n(Bt);const Kt=(e,t)=>{switch(t.status){case"submitting":return{isSubmitting:!0};case"submitted":return{isSubmitted:!0};case"error":return{hasError:!0,message:t.message};default:return{}}};var Ut=({postId:e,onClose:t})=>{const[n,r]=Object(c.useReducer)(Kt,{}),[a,o]=Object(c.useState)(""),[l,u]=Object(c.useState)(""),p=Object(c.useRef)(),d=Object(i.__)("Your report has been submitted.","wporg-patterns"),{isLoading:b,mappedReasons:g}=Object(s.useSelect)(e=>{const{getPatternFlagReasons:t,isLoadingPatternFlagReasons:n}=e(de),r=t()||[];return{isLoading:n(),mappedReasons:r.sort((e,t)=>{switch(!0){case e.slug<t.slug:return-1;case e.slug>t.slug:return 1;default:return 0}}).map(e=>({label:e.name,value:e.id.toString()}))}}),f=()=>{t(n.isSubmitted)};return Object(c.createElement)(fe.Modal,{className:"pattern-report-modal "+(n.isSubmitted?"":"pattern-report-modal__has-fixed-height"),title:Object(i.__)("Report this pattern","wporg-patterns"),onRequestClose:f},Object(c.createElement)("div",{ref:p},b?Object(c.createElement)(fe.Spinner,null):n.isSubmitted?Object(c.createElement)("p",{className:"pattern-report-modal__copy"},d):Object(c.createElement)("form",{onSubmit:t=>{t.preventDefault(),a&&l.length&&!n.isSubmitted&&!n.isSubmitting&&(r({status:"submitting"}),qt()({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern-flag"),method:"POST",data:{parent:e,"wporg-pattern-flag-reason":a,excerpt:l}}).then(()=>{r({status:"submitted"}),Object(St.speak)(d),p.current.closest('[role="dialog"]').focus()}).catch(e=>{r({status:"error",message:e.message}),Object(St.speak)(Object(i.sprintf)(
 /* translators: %s: Error message. */
-Object(i.__)("Error: %s","wporg-patterns"),e.message))}))}},Object(c.createElement)(fe.RadioControl,{className:"pattern-report-modal__radio",label:Object(i.__)("Please choose a reason:","wporg-patterns"),selected:a,options:g,onChange:o,required:!0}),Object(c.createElement)(fe.TextareaControl,{label:Object(i.__)("Please provide details (required)","wporg-patterns"),value:l,onChange:u,required:!0}),n.hasError&&Object(c.createElement)("div",{className:"notice notice-large notice-alt notice-error"},n.message),Object(c.createElement)("div",{className:"pattern-report-modal__actions"},Object(c.createElement)(fe.Button,{isSecondary:!0,onClick:f},Object(i.__)("Cancel","wporg-patterns")),Object(c.createElement)(fe.Button,{type:"submit",isBusy:n.isSubmitting,isPrimary:!0},n.isSubmitting?Object(i.__)("Submitting …","wporg-patterns"):Object(i.__)("Report","wporg-patterns"))))))},$t=({postId:e,userHasReported:t})=>{const[n,r]=Object(c.useState)(!1),[a,o]=Object(c.useState)(!1),s=t||a,l=!!wporgPatternsData.userId;return s?Object(c.createElement)("p",{className:"pattern-report-button__copy"},Object(c.createElement)(Mt,{icon:Qt}),Object(i.__)("You've reported this pattern","wporg-patterns")):l?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(fe.Button,{className:"pattern-report-button",isLink:!0,onClick:()=>r(!0)},Object(i.__)("Report this pattern","wporg-patterns")),n&&Object(c.createElement)(Ut,{postId:e,onClose:e=>{r(!1),o(e)}})):Object(c.createElement)("p",{className:"pattern-report-button__copy"},Object(c.createElement)("a",{href:Object(O.addQueryArgs)("/wp-login.php",{redirect_to:window.location.pathname})},Object(i.__)("Login to report this pattern","wporg-patterns")))},Vt=({postId:e,userHasReported:t})=>{e=Number(e)||0;const n=Object(s.useSelect)(t=>t(de).getPattern(e),[e]);return n?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(It,{postId:e}),Object(c.createElement)("div",{className:"pattern-preview__container"},Object(c.createElement)(jt,{blockContent:n.content.rendered}),Object(c.createElement)("div",{className:"pattern__meta"},Object(c.createElement)($t,{userHasReported:"true"===t,postId:e}))),Object(c.createElement)("div",{className:"entry-content"},Object(c.createElement)(be,{query:{author:n.author,per_page:3,exclude:e},showPagination:!1,header:Object(c.createElement)(c.Fragment,null,Object(c.createElement)("h2",null,Object(i.__)("More from this designer","wporg-patterns")),Object(c.createElement)(l,n.author_meta))},e=>Object(c.createElement)(Dt,{key:e.id,pattern:e})))):null},Gt=function(){return Object(c.createElement)("div",{className:"pattern-grid__empty-header"},Object(c.createElement)("h2",null,Object(i.__)("No results found","wporg-patterns")),Object(c.createElement)("p",null,Object(c.createInterpolateElement)(Object(i.__)("View <a>all block patterns</a> or browse some of our recent patterns.","wporg-patterns"),{a:Object(c.createElement)("a",{href:wporgPatternsUrl.site})})))},Ht=Object.prototype.hasOwnProperty;function zt(e,t,n){for(n of e.keys())if(Wt(n,t))return n}function Wt(e,t){var n,r,a;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&Wt(e[r],t[r]););return-1===r}if(n===Set){if(e.size!==t.size)return!1;for(r of e){if((a=r)&&"object"==typeof a&&!(a=zt(t,a)))return!1;if(!t.has(a))return!1}return!0}if(n===Map){if(e.size!==t.size)return!1;for(r of e){if((a=r[0])&&"object"==typeof a&&!(a=zt(t,a)))return!1;if(!Wt(r[1],t.get(a)))return!1}return!0}if(n===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(n===DataView){if((r=e.byteLength)===t.byteLength)for(;r--&&e.getInt8(r)===t.getInt8(r););return-1===r}if(ArrayBuffer.isView(e)){if((r=e.byteLength)===t.byteLength)for(;r--&&e[r]===t[r];);return-1===r}if(!n||"object"==typeof e){for(n in r=0,e){if(Ht.call(e,n)&&++r&&!Ht.call(t,n))return!1;if(!(n in t)||!Wt(e[n],t[n]))return!1}return Object.keys(t).length===r}}return e!=e&&t!=t}var Yt=function(e,t){return Object(Oe.useEffect)(e,(n=t,r=Object(Oe.useRef)(),a=Object(Oe.useRef)(0),Wt(n,r.current)||(r.current=n,a.current+=1),[a.current]));var n,r,a},Xt=function(e){const{path:t}=E(),[n,r]=Object(c.useState)(),[a]=Object(c.useState)({title:"",links:[]}),{author:o,category:l,count:u,isLoadingPatterns:p,query:d}=Object(s.useSelect)(n=>{const{getCategoryById:r,getPatternTotalsByQuery:a,getQueryFromUrl:o,isLoadingPatternsByQuery:c}=n(de),i={...o(t),...e.query};return{author:null==i?void 0:i.author_name,category:r(i["pattern-categories"]),count:a(i),isLoadingPatterns:c(i),query:i}},[t,e.query]);Yt(()=>{if(((e={})=>!e.hasOwnProperty("include")||e.include.length>0)(d)&&p)return void r((({category:e,author:t})=>e&&t?Object(c.createInterpolateElement)(Object(i.sprintf)(
+Object(i.__)("Error: %s","wporg-patterns"),e.message))}))}},Object(c.createElement)(fe.RadioControl,{className:"pattern-report-modal__radio",label:Object(i.__)("Please choose a reason:","wporg-patterns"),selected:a,options:g,onChange:o,required:!0}),Object(c.createElement)(fe.TextareaControl,{label:Object(i.__)("Please provide details (required)","wporg-patterns"),value:l,onChange:u,required:!0}),n.hasError&&Object(c.createElement)("div",{className:"notice notice-large notice-alt notice-error"},n.message),Object(c.createElement)("div",{className:"pattern-report-modal__actions"},Object(c.createElement)(fe.Button,{isSecondary:!0,onClick:f},Object(i.__)("Cancel","wporg-patterns")),Object(c.createElement)(fe.Button,{type:"submit",isBusy:n.isSubmitting,isPrimary:!0},n.isSubmitting?Object(i.__)("Submitting …","wporg-patterns"):Object(i.__)("Report","wporg-patterns"))))))},$t=({postId:e,userHasReported:t})=>{const[n,r]=Object(c.useState)(!1),[a,o]=Object(c.useState)(!1),s=t||a,l=!!wporgPatternsData.userId;return s?Object(c.createElement)("p",{className:"pattern-report-button__copy"},Object(c.createElement)(Mt,{icon:Qt}),Object(i.__)("You've reported this pattern","wporg-patterns")):l?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(fe.Button,{className:"pattern-report-button",isLink:!0,onClick:()=>r(!0)},Object(i.__)("Report this pattern","wporg-patterns")),n&&Object(c.createElement)(Ut,{postId:e,onClose:e=>{r(!1),o(e)}})):Object(c.createElement)("p",{className:"pattern-report-button__copy"},Object(c.createElement)("a",{href:Object(O.addQueryArgs)("/wp-login.php",{redirect_to:window.location.pathname})},Object(i.__)("Login to report this pattern","wporg-patterns")))},Vt=({postId:e,userHasReported:t})=>{e=Number(e)||0;const n=Object(s.useSelect)(t=>t(de).getPattern(e),[e]);return n?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(It,{postId:e}),Object(c.createElement)("div",{className:"pattern-preview__container"},Object(c.createElement)(jt,{blockContent:n.content.rendered}),Object(c.createElement)("div",{className:"pattern__meta"},Object(c.createElement)($t,{userHasReported:"true"===t,postId:e}))),Object(c.createElement)("div",{className:"entry-content"},Object(c.createElement)(be,{query:{author:n.author,per_page:3,exclude:e},showPagination:!1,header:Object(c.createElement)(c.Fragment,null,Object(c.createElement)("h2",null,Object(i.__)("More from this designer","wporg-patterns")),Object(c.createElement)(l,n.author_meta))},e=>Object(c.createElement)(Ft,{key:e.id,pattern:e})))):null},Gt=function(){return Object(c.createElement)("div",{className:"pattern-grid__empty-header"},Object(c.createElement)("h2",null,Object(i.__)("No results found","wporg-patterns")),Object(c.createElement)("p",null,Object(c.createInterpolateElement)(Object(i.__)("View <a>all block patterns</a> or browse some of our recent patterns.","wporg-patterns"),{a:Object(c.createElement)("a",{href:wporgPatternsUrl.site})})))},Ht=Object.prototype.hasOwnProperty;function zt(e,t,n){for(n of e.keys())if(Wt(n,t))return n}function Wt(e,t){var n,r,a;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)for(;r--&&Wt(e[r],t[r]););return-1===r}if(n===Set){if(e.size!==t.size)return!1;for(r of e){if((a=r)&&"object"==typeof a&&!(a=zt(t,a)))return!1;if(!t.has(a))return!1}return!0}if(n===Map){if(e.size!==t.size)return!1;for(r of e){if((a=r[0])&&"object"==typeof a&&!(a=zt(t,a)))return!1;if(!Wt(r[1],t.get(a)))return!1}return!0}if(n===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(n===DataView){if((r=e.byteLength)===t.byteLength)for(;r--&&e.getInt8(r)===t.getInt8(r););return-1===r}if(ArrayBuffer.isView(e)){if((r=e.byteLength)===t.byteLength)for(;r--&&e[r]===t[r];);return-1===r}if(!n||"object"==typeof e){for(n in r=0,e){if(Ht.call(e,n)&&++r&&!Ht.call(t,n))return!1;if(!(n in t)||!Wt(e[n],t[n]))return!1}return Object.keys(t).length===r}}return e!=e&&t!=t}var Yt=function(e,t){return Object(Oe.useEffect)(e,(n=t,r=Object(Oe.useRef)(),a=Object(Oe.useRef)(0),Wt(n,r.current)||(r.current=n,a.current+=1),[a.current]));var n,r,a},Xt=function(e){const{path:t}=E(),[n,r]=Object(c.useState)(),[a]=Object(c.useState)({title:"",links:[]}),{author:o,category:l,count:u,isLoadingPatterns:p,query:d}=Object(s.useSelect)(n=>{const{getCategoryById:r,getPatternTotalsByQuery:a,getQueryFromUrl:o,isLoadingPatternsByQuery:c}=n(de),i={...o(t),...e.query};return{author:wporgPatternsData.currentAuthorName||(null==i?void 0:i.author_name),category:r(i["pattern-categories"]),count:a(i),isLoadingPatterns:c(i),query:i}},[t,e.query]);Yt(()=>{if(((e={})=>!e.hasOwnProperty("include")||e.include.length>0)(d)&&p)return void r((({category:e,author:t})=>e&&t?Object(c.createInterpolateElement)(Object(i.sprintf)(
 /* translators: %1$s category name, %2$s author name. */
 Object(i.__)("Loading <b>%1$s</b> patterns by %2$s.","wporg-patterns"),e,t),{b:Object(c.createElement)("b",null)}):e?Object(c.createInterpolateElement)(Object(i.sprintf)(
@@ -20,7 +20,7 @@
 Object(i._n)("%1$d <b>%2$s</b> pattern.","%1$d <b>%2$s</b> patterns.",n,"wporg-patterns"),n,e,"wporg-patterns"),{b:Object(c.createElement)("b",null)}):t?Object(c.createInterpolateElement)(Object(i.sprintf)(
 /* translators: %1$d: number of patterns, %2$s author name. */
-Object(i._n)("%1$d pattern by <b>%2$s</b>.","%1$d patterns by <b>%2$s</b>.",n,"wporg-patterns"),n,t),{b:Object(c.createElement)("b",null)}):Object(i.__)("Loading patterns","wporg-patterns"))({category:null==l?void 0:l.name,author:o},u)),null!=d&&d.include&&!l&&r(""))},[d,p]);const b=wt()({"context-bar__spinner":!0,"context-bar__spinner--is-hidden":!p});return n?Object(c.createElement)("header",{className:"context-bar"},Object(c.createElement)("h2",{className:"context-bar__copy"},Object(c.createElement)("span",{className:b},Object(c.createElement)(fe.Spinner,null)),Object(c.createElement)("span",null,n)),a.links&&a.links.length>0&&Object(c.createElement)("div",{className:"context-bar__links"},Object(c.createElement)("h3",{className:"context-bar__title"},a.title),Object(c.createElement)("ul",null,a.links.map(e=>Object(c.createElement)("li",{key:e.href},Object(c.createElement)("a",{href:e.href},e.label)))))):null},Jt=({options:e})=>{const{path:t,replace:n}=E(),r=Object(ge.useViewportMatch)("medium",">=");return e?Object(c.createElement)("div",{className:"pattern-order-select"},Object(c.createElement)(fe.SelectControl,{label:Object(i.__)("Order by","wporg-patterns"),labelPosition:"side",hideLabelFromVision:r,value:Object(O.getQueryArg)(window.location.href,"orderby"),options:e,onChange:e=>{n(Object(O.addQueryArgs)(t,{orderby:e}).replace(/\/page\/[\d]+/,""))}})):null},Zt=()=>Object(c.createElement)(u,{className:"pattern-menu",style:{flexDirection:"row"}},Array(7).fill().map((e,t)=>Object(c.createElement)(p,{key:t,height:"1.25rem",width:"5rem",marginRight:"1rem"}))),en=({current:e,isLoading:t,label:n=Object(i.__)("Main Menu","wporg-patterns"),onClick:r,options:a})=>t?Object(c.createElement)(Zt,null):a.length?Object(c.createElement)("nav",null,Object(c.createElement)("h2",{className:"screen-reader-text"},n),Object(c.createElement)("ul",{className:"pattern-menu"},a.map(t=>Object(c.createElement)("li",{key:t.value},Object(c.createElement)("a",{className:wt()({"pattern-menu__item":!0,"is-active":e===t.slug}),href:t.value,onClick:r,"aria-current":e===t.slug?"page":void 0},t.label))))):null,tn=({onClick:e,options:t,label:n=Object(i.__)("Browse categories","wporg-patterns")})=>{const[r,a]=Object(c.useState)(!1);return Object(c.createElement)(fe.PanelBody,{className:"pattern-menu is-mobile",title:n,initialOpen:r,opened:r,onToggle:()=>a(!r)},Object(c.createElement)("ul",null,t.map(t=>Object(c.createElement)("li",{key:t.value},Object(c.createElement)("a",{href:t.value,onClick:t=>{a(!1),e(t)}},t.label)))))},nn=e=>Object(ge.useViewportMatch)("medium","<")?Object(c.createElement)(tn,e):Object(c.createElement)(en,e),rn=({primary:e,secondary:t})=>Object(c.createElement)("div",{className:"pattern-navigation-layout"},e&&Object(c.createElement)("div",{className:"pattern-navigation-layout__primary"},e),t&&Object(c.createElement)("div",{className:"pattern-navigation-layout__secondary"},t)),an=({basePath:e="",...t})=>{const{path:n,update:r}=E(),{categorySlug:a,isLoading:o,options:l}=Object(s.useSelect)(t=>{var r;const{getCategoryById:a,getCategories:o,getQueryFromUrl:c,getUrlFromQuery:i,isLoadingCategories:s}=t(de),l=c(n);delete l.page;const u=(o()||[]).map(t=>({value:i({...l,"pattern-categories":t.id},wporgPatternsUrl.site+e),slug:t.slug,label:t.name}));return{categorySlug:(null===(r=a(l["pattern-categories"]))||void 0===r?void 0:r.slug)||"",isLoading:s(),options:u}});return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(rn,{primary:Object(c.createElement)(nn,{current:a,options:l||[],onClick:e=>{e.preventDefault(),r(e.target.pathname)},isLoading:o}),secondary:Object(c.createElement)(Jt,{options:[{label:Object(i.__)("Newest","wporg-patterns"),value:"date"},{label:Object(i.__)("Favorites","wporg-patterns"),value:"favorite_count"}]})}),Object(c.createElement)(Xt,t))},on=()=>{const{setCurrentQuery:e}=Object(s.useDispatch)(de),{path:t}=E(),n=Object(s.useSelect)(e=>e(de).getQueryFromUrl(t),[t]);return Yt(()=>{e(n)},[n]),null};const cn=e=>{const t=document.getElementById("breadcrumb-part");t&&(t.innerText=e)};var sn=()=>{const{path:e}=E(),{authorName:t,categoryName:n,query:r}=Object(s.useSelect)(t=>{const n=t(de).getQueryFromUrl(e),r=t(de).getCategoryById(n["pattern-categories"]);return{query:n,authorName:null==n?void 0:n.author_name,categoryName:null==r?void 0:r.name}},[]);return Object(c.useEffect)(()=>{t?
+Object(i._n)("%1$d pattern by <b>%2$s</b>.","%1$d patterns by <b>%2$s</b>.",n,"wporg-patterns"),n,t),{b:Object(c.createElement)("b",null)}):Object(i.__)("Loading patterns","wporg-patterns"))({category:null==l?void 0:l.name,author:o},u)),null!=d&&d.include&&!l&&r(""))},[d,p]);const b=wt()({"context-bar__spinner":!0,"context-bar__spinner--is-hidden":!p});return n?Object(c.createElement)("header",{className:"context-bar"},Object(c.createElement)("h2",{className:"context-bar__copy"},Object(c.createElement)("span",{className:b},Object(c.createElement)(fe.Spinner,null)),Object(c.createElement)("span",null,n)),a.links&&a.links.length>0&&Object(c.createElement)("div",{className:"context-bar__links"},Object(c.createElement)("h3",{className:"context-bar__title"},a.title),Object(c.createElement)("ul",null,a.links.map(e=>Object(c.createElement)("li",{key:e.href},Object(c.createElement)("a",{href:e.href},e.label)))))):null},Jt=({options:e})=>{const{path:t,replace:n}=E(),r=Object(ge.useViewportMatch)("medium",">=");return e?Object(c.createElement)("div",{className:"pattern-order-select"},Object(c.createElement)(fe.SelectControl,{label:Object(i.__)("Order by","wporg-patterns"),labelPosition:"side",hideLabelFromVision:r,value:Object(O.getQueryArg)(window.location.href,"orderby"),options:e,onChange:e=>{n(Object(O.addQueryArgs)(t,{orderby:e}).replace(/\/page\/[\d]+/,""))}})):null},Zt=()=>Object(c.createElement)(u,{className:"pattern-menu",style:{flexDirection:"row"}},Array(7).fill().map((e,t)=>Object(c.createElement)(p,{key:t,height:"1.25rem",width:"5rem",marginRight:"1rem"}))),en=({current:e,isLoading:t,label:n=Object(i.__)("Main Menu","wporg-patterns"),onClick:r,options:a})=>t?Object(c.createElement)(Zt,null):a.length?Object(c.createElement)("nav",null,Object(c.createElement)("h2",{className:"screen-reader-text"},n),Object(c.createElement)("ul",{className:"pattern-menu"},a.map(t=>Object(c.createElement)("li",{key:t.value},Object(c.createElement)("a",{className:wt()({"pattern-menu__item":!0,"is-active":e===t.slug}),href:t.value,onClick:r,"aria-current":e===t.slug?"page":void 0},t.label))))):null,tn=({onClick:e,options:t,label:n=Object(i.__)("Browse categories","wporg-patterns")})=>{const[r,a]=Object(c.useState)(!1);return Object(c.createElement)(fe.PanelBody,{className:"pattern-menu is-mobile",title:n,initialOpen:r,opened:r,onToggle:()=>a(!r)},Object(c.createElement)("ul",null,t.map(t=>Object(c.createElement)("li",{key:t.value},Object(c.createElement)("a",{href:t.value,onClick:t=>{a(!1),e(t)}},t.label)))))},nn=e=>Object(ge.useViewportMatch)("medium","<")?Object(c.createElement)(tn,e):Object(c.createElement)(en,e),rn=({primary:e,secondary:t})=>Object(c.createElement)("div",{className:"pattern-navigation-layout"},e&&Object(c.createElement)("div",{className:"pattern-navigation-layout__primary"},e),t&&Object(c.createElement)("div",{className:"pattern-navigation-layout__secondary"},t)),an=({basePath:e="",...t})=>{const{path:n,update:r}=E(),{categorySlug:a,isLoading:o,options:l}=Object(s.useSelect)(t=>{var r;const{getCategoryById:a,getCategories:o,getQueryFromUrl:c,getUrlFromQuery:i,isLoadingCategories:s}=t(de),l=c(n);delete l.page;const u=(o()||[]).map(t=>({value:i({...l,"pattern-categories":t.id},wporgPatternsUrl.site+e),slug:t.slug,label:t.name}));return{categorySlug:(null===(r=a(l["pattern-categories"]))||void 0===r?void 0:r.slug)||"",isLoading:s(),options:u}});return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(rn,{primary:Object(c.createElement)(nn,{current:a,options:l||[],onClick:e=>{e.preventDefault(),r(e.target.pathname)},isLoading:o}),secondary:Object(c.createElement)(Jt,{options:[{label:Object(i.__)("Newest","wporg-patterns"),value:"date"},{label:Object(i.__)("Favorites","wporg-patterns"),value:"favorite_count"}]})}),Object(c.createElement)(Xt,t))},on=()=>{const{setCurrentQuery:e}=Object(s.useDispatch)(de),{path:t}=E(),n=Object(s.useSelect)(e=>e(de).getQueryFromUrl(t),[t]);return Yt(()=>{e(n)},[n]),null};const cn=e=>{const t=document.getElementById("breadcrumb-part");t&&(t.innerText=e)};var sn=()=>{const{path:e}=E(),{authorName:t,categoryName:n}=Object(s.useSelect)(t=>{const n=t(de).getQueryFromUrl(e),r=t(de).getCategoryById(n["pattern-categories"]);return{authorName:wporgPatternsData.currentAuthorName||(null==n?void 0:n.author_name),categoryName:null==r?void 0:r.name}},[]);return Object(c.useEffect)(()=>{t?
 // translators: %s is the author name.
-cn(Object(i.sprintf)(Object(i.__)("Author: %s","wporg-patterns"),r.author_name)):n&&
+cn(Object(i.sprintf)(Object(i.__)("Author: %s","wporg-patterns"),t)):n&&
 // translators: %s is the category name.
-cn(Object(i.sprintf)(Object(i.__)("Category: %s","wporg-patterns"),n))},[e]),null},ln=function({isLoggedIn:e}){const t=Object(O.addQueryArgs)(wporgPatternsUrl.login,{redirect_to:window.location}),n=Object(O.addQueryArgs)(wporgPatternsUrl.register,{redirect_to:window.location});return e?Object(c.createElement)("div",{className:"pattern-grid__empty-header pattern-favorites__empty-header"},Object(c.createElement)("h2",null,Object(i.__)("Collect and view your favorite patterns.","wporg-patterns")),Object(c.createElement)("p",null,Object(i.__)("Tap the heart on any pattern to make it as a favorite. All your favorite patterns will appear here.","wporg-patterns"))):Object(c.createElement)("div",{className:"pattern-grid__empty-header pattern-favorites__empty-header"},Object(c.createElement)("h2",null,Object(i.__)("Collect and view your favorite patterns.","wporg-patterns")),Object(c.createElement)("p",null,Object(i.__)("Log in to your WordPress.org account and you’ll be able to see all your favorite patterns in one place.","wporg-patterns")),Object(c.createElement)("p",null,Object(c.createElement)("a",{className:"button button-primary button-large",href:t},Object(i.__)("Log in","wporg-patterns"))),Object(c.createElement)("p",null,Object(c.createElement)("a",{className:"button-link link-create-account",href:n},Object(i.__)("Create an account","wporg-patterns"))))},un=function(){const{path:e,update:t}=E();let n=j(e,"my-patterns");"page"===n&&(n="all");const r=[{value:wporgPatternsUrl.site+"/my-patterns/",slug:"all",label:Object(i.__)("All","wporg-patterns")},{value:wporgPatternsUrl.site+"/my-patterns/draft/",slug:"draft",label:Object(i.__)("Drafts","wporg-patterns")},{value:wporgPatternsUrl.site+"/my-patterns/pending/",slug:"pending",label:Object(i.__)("Pending Review","wporg-patterns")}];return Object(c.createElement)(nn,{label:Object(i.__)("Menu","wporg-patterns"),current:n||"all",options:r,onClick:e=>{e.preventDefault(),t(e.target.pathname)},isLoading:!1})};const pn=document.getElementById("patterns__container");pn&&Object(c.render)(Object(c.createElement)(()=>{const{isEmpty:e,query:t}=Object(s.useSelect)(e=>{const{getCurrentQuery:t,getPatternsByQuery:n,isLoadingPatternsByQuery:r}=e(de),a=t(),o=a&&r(a),c=a?n(a):[];return{isEmpty:!o&&!c.length,query:a}});return Object(c.createElement)(w,null,Object(c.createElement)(on,null),Object(c.createElement)(sn,null),Object(c.createElement)(an,null),e?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(Gt,null),Object(c.createElement)(be,{query:{per_page:6},showPagination:!1},e=>Object(c.createElement)(Dt,{key:e.id,pattern:e,showAvatar:!0}))):Object(c.createElement)(be,{query:t},e=>Object(c.createElement)(Dt,{key:e.id,pattern:e,showAvatar:!0})))},null),pn);const dn=document.getElementById("my-patterns__container");dn&&Object(c.render)(Object(c.createElement)(()=>{const e=wporgPatternsData.userId,{isEmpty:t,query:n}=Object(s.useSelect)(t=>{const{getCurrentQuery:n,getPatternsByQuery:r,isLoadingPatternsByQuery:a}=t(de),o={status:"any",...n()||{},author:e},c=e&&a(o),i=e?r(o):[];return{isEmpty:!c&&!i.length,query:o}});if(!e){const e=Object(O.addQueryArgs)(wporgPatternsUrl.login,{redirect_to:window.location});return Object(c.createElement)("div",{className:"entry-content"},Object(c.createElement)("p",null,Object(i.__)("Please log in to view your patterns.","wporg-patterns")),Object(c.createElement)("a",{className:"button button-primary",href:e},Object(i.__)("Log in","wporg-patterns")))}return Object(c.createElement)(w,null,Object(c.createElement)(on,null),Object(c.createElement)(rn,{primary:Object(c.createElement)(un,null),secondary:Object(c.createElement)(Jt,{options:[{label:Object(i.__)("Newest","wporg-patterns"),value:"date"},{label:Object(i.__)("Favorites","wporg-patterns"),value:"favorite_count"}]})}),t?Object(c.createElement)("div",{className:"pattern-grid__empty-header"},Object(c.createElement)("h2",null,Object(i.__)("Nothing found","wporg-patterns")),Object(c.createElement)("p",null,Object(i.__)("You haven’t created any patterns yet.","wporg-patterns"))):Object(c.createElement)(be,{query:n},e=>Object(c.createElement)(Dt,{key:e.id,pattern:e})))},null),dn);const bn=document.getElementById("pattern-favorites__container");bn&&Object(c.render)(Object(c.createElement)(()=>{const{isEmpty:e,query:t}=Object(s.useSelect)(e=>{const{getCurrentQuery:t,getFavorites:n,getPatternsByQuery:r,isLoadingPatternsByQuery:a}=e(de),o=t()||{},c=n();if(null===c)return{query:!1,isEmpty:!1};const i={...o,include:c},s=!!c.length&&a(i),l=c.length?r(i):[];return{query:i,isEmpty:!s&&!l.length}}),n={orderby:"favorite_count",per_page:6};t["pattern-categories"]&&(n["pattern-categories"]=t["pattern-categories"]);const r=!!wporgPatternsData.userId;return Object(c.createElement)(w,null,Object(c.createElement)(on,null),r&&Object(c.createElement)(an,{basePath:"/favorites/",query:t}),!r||e?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(ln,{isLoggedIn:r}),Object(c.createElement)(be,{header:Object(c.createElement)("h2",{className:"pattern-favorites__grid-title"},Object(i.__)("Here’s a few of our favorite patterns","wporg-patterns")),query:n,showPagination:!1},e=>Object(c.createElement)(Dt,{key:e.id,pattern:e,showAvatar:!0}))):Object(c.createElement)(be,{query:t},e=>Object(c.createElement)(Dt,{key:e.id,pattern:e,showAvatar:!0})))},null),bn);const gn=document.querySelectorAll(".pattern__container");for(let e=0;e<gn.length;e++){const t=gn[e],n=t.dataset;Object(c.render)(Object(c.createElement)(Vt,n),t,()=>{t.hidden=!1,document.querySelectorAll(".hide-if-pattern-loaded").forEach(e=>e.hidden=!0)})}const fn=document.getElementById("patterns-search__container");fn&&Object(c.render)(Object(c.createElement)(()=>{const{isEmpty:e,query:t}=Object(s.useSelect)(e=>{const{getCurrentQuery:t,getPatternsByQuery:n,isLoadingPatternsByQuery:r}=e(de),a=t(),o=a&&r(a),c=a?n(a):[];return{isEmpty:!o&&!c.length,query:a}});return Object(c.createElement)(w,null,Object(c.createElement)(on,null),Object(c.createElement)(Xt,{query:t}),e?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(Gt,null),Object(c.createElement)(be,{query:{per_page:6},showPagination:!1},e=>Object(c.createElement)(Dt,{key:e.id,pattern:e,showAvatar:!0}))):Object(c.createElement)(be,{query:t},e=>Object(c.createElement)(Dt,{key:e.id,pattern:e,showAvatar:!0})))},fn.dataset),fn)}]);
+cn(Object(i.sprintf)(Object(i.__)("Category: %s","wporg-patterns"),n))},[e]),null},ln=function({isLoggedIn:e}){const t=Object(O.addQueryArgs)(wporgPatternsUrl.login,{redirect_to:window.location}),n=Object(O.addQueryArgs)(wporgPatternsUrl.register,{redirect_to:window.location});return e?Object(c.createElement)("div",{className:"pattern-grid__empty-header pattern-favorites__empty-header"},Object(c.createElement)("h2",null,Object(i.__)("Collect and view your favorite patterns.","wporg-patterns")),Object(c.createElement)("p",null,Object(i.__)("Tap the heart on any pattern to make it as a favorite. All your favorite patterns will appear here.","wporg-patterns"))):Object(c.createElement)("div",{className:"pattern-grid__empty-header pattern-favorites__empty-header"},Object(c.createElement)("h2",null,Object(i.__)("Collect and view your favorite patterns.","wporg-patterns")),Object(c.createElement)("p",null,Object(i.__)("Log in to your WordPress.org account and you’ll be able to see all your favorite patterns in one place.","wporg-patterns")),Object(c.createElement)("p",null,Object(c.createElement)("a",{className:"button button-primary button-large",href:t},Object(i.__)("Log in","wporg-patterns"))),Object(c.createElement)("p",null,Object(c.createElement)("a",{className:"button-link link-create-account",href:n},Object(i.__)("Create an account","wporg-patterns"))))},un=function(){const{path:e,update:t}=E();let n=j(e,"my-patterns");"page"===n&&(n="all");const r=[{value:wporgPatternsUrl.site+"/my-patterns/",slug:"all",label:Object(i.__)("All","wporg-patterns")},{value:wporgPatternsUrl.site+"/my-patterns/draft/",slug:"draft",label:Object(i.__)("Drafts","wporg-patterns")},{value:wporgPatternsUrl.site+"/my-patterns/pending/",slug:"pending",label:Object(i.__)("Pending Review","wporg-patterns")}];return Object(c.createElement)(nn,{label:Object(i.__)("Menu","wporg-patterns"),current:n||"all",options:r,onClick:e=>{e.preventDefault(),t(e.target.pathname)},isLoading:!1})};const pn=document.getElementById("patterns__container");pn&&Object(c.render)(Object(c.createElement)(()=>{const{isEmpty:e,query:t}=Object(s.useSelect)(e=>{const{getCurrentQuery:t,getPatternsByQuery:n,isLoadingPatternsByQuery:r}=e(de),a=t(),o=a&&r(a),c=a?n(a):[];return{isEmpty:!o&&!c.length,query:a}});return Object(c.createElement)(w,null,Object(c.createElement)(on,null),Object(c.createElement)(sn,null),Object(c.createElement)(an,null),e?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(Gt,null),Object(c.createElement)(be,{query:{per_page:6},showPagination:!1},e=>Object(c.createElement)(Ft,{key:e.id,pattern:e,showAvatar:!0}))):Object(c.createElement)(be,{query:t},e=>Object(c.createElement)(Ft,{key:e.id,pattern:e,showAvatar:!0})))},null),pn);const dn=document.getElementById("my-patterns__container");dn&&Object(c.render)(Object(c.createElement)(()=>{const e=wporgPatternsData.userId,{isEmpty:t,query:n}=Object(s.useSelect)(t=>{const{getCurrentQuery:n,getPatternsByQuery:r,isLoadingPatternsByQuery:a}=t(de),o={status:"any",...n()||{},author:e},c=e&&a(o),i=e?r(o):[];return{isEmpty:!c&&!i.length,query:o}});if(!e){const e=Object(O.addQueryArgs)(wporgPatternsUrl.login,{redirect_to:window.location});return Object(c.createElement)("div",{className:"entry-content"},Object(c.createElement)("p",null,Object(i.__)("Please log in to view your patterns.","wporg-patterns")),Object(c.createElement)("a",{className:"button button-primary",href:e},Object(i.__)("Log in","wporg-patterns")))}return Object(c.createElement)(w,null,Object(c.createElement)(on,null),Object(c.createElement)(rn,{primary:Object(c.createElement)(un,null),secondary:Object(c.createElement)(Jt,{options:[{label:Object(i.__)("Newest","wporg-patterns"),value:"date"},{label:Object(i.__)("Favorites","wporg-patterns"),value:"favorite_count"}]})}),t?Object(c.createElement)("div",{className:"pattern-grid__empty-header"},Object(c.createElement)("h2",null,Object(i.__)("Nothing found","wporg-patterns")),Object(c.createElement)("p",null,Object(i.__)("You haven’t created any patterns yet.","wporg-patterns"))):Object(c.createElement)(be,{query:n},e=>Object(c.createElement)(Ft,{key:e.id,pattern:e})))},null),dn);const bn=document.getElementById("pattern-favorites__container");bn&&Object(c.render)(Object(c.createElement)(()=>{const{isEmpty:e,query:t}=Object(s.useSelect)(e=>{const{getCurrentQuery:t,getFavorites:n,getPatternsByQuery:r,isLoadingPatternsByQuery:a}=e(de),o=t()||{},c=n();if(null===c)return{query:!1,isEmpty:!1};const i={...o,include:c},s=!!c.length&&a(i),l=c.length?r(i):[];return{query:i,isEmpty:!s&&!l.length}}),n={orderby:"favorite_count",per_page:6};t["pattern-categories"]&&(n["pattern-categories"]=t["pattern-categories"]);const r=!!wporgPatternsData.userId;return Object(c.createElement)(w,null,Object(c.createElement)(on,null),r&&Object(c.createElement)(an,{basePath:"/favorites/",query:t}),!r||e?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(ln,{isLoggedIn:r}),Object(c.createElement)(be,{header:Object(c.createElement)("h2",{className:"pattern-favorites__grid-title"},Object(i.__)("Here’s a few of our favorite patterns","wporg-patterns")),query:n,showPagination:!1},e=>Object(c.createElement)(Ft,{key:e.id,pattern:e,showAvatar:!0}))):Object(c.createElement)(be,{query:t},e=>Object(c.createElement)(Ft,{key:e.id,pattern:e,showAvatar:!0})))},null),bn);const gn=document.querySelectorAll(".pattern__container");for(let e=0;e<gn.length;e++){const t=gn[e],n=t.dataset;Object(c.render)(Object(c.createElement)(Vt,n),t,()=>{t.hidden=!1,document.querySelectorAll(".hide-if-pattern-loaded").forEach(e=>e.hidden=!0)})}const fn=document.getElementById("patterns-search__container");fn&&Object(c.render)(Object(c.createElement)(()=>{const{isEmpty:e,query:t}=Object(s.useSelect)(e=>{const{getCurrentQuery:t,getPatternsByQuery:n,isLoadingPatternsByQuery:r}=e(de),a=t(),o=a&&r(a),c=a?n(a):[];return{isEmpty:!o&&!c.length,query:a}});return Object(c.createElement)(w,null,Object(c.createElement)(on,null),Object(c.createElement)(Xt,{query:t}),e?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(Gt,null),Object(c.createElement)(be,{query:{per_page:6},showPagination:!1},e=>Object(c.createElement)(Ft,{key:e.id,pattern:e,showAvatar:!0}))):Object(c.createElement)(be,{query:t},e=>Object(c.createElement)(Ft,{key:e.id,pattern:e,showAvatar:!0})))},fn.dataset),fn)}]);
Index: /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/functions.php
===================================================================
--- /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/functions.php	(revision 11163)
+++ /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/functions.php	(revision 11164)
@@ -86,4 +86,5 @@
 				rawurlencode( wp_json_encode( array(
 					'userId' => get_current_user_id(),
+					'currentAuthorName' => esc_html( get_the_author_meta( 'display_name' ) ),
 				) ) ),
 			),
@@ -202,10 +203,13 @@
 
 /**
- * Add the "My Patterns" status rewrites.
- * This will redirect `my-patterns/draft`, `my-patterns/pending` etc to use the My Patterns page.
+ * Add rewrites needed for nested page navigation.
+ * - `my-patterns/<status>` will render the My Patterns page.
+ * - `favorites/categories/<cat>` will render the Favorites page.
+ * - `author/<username>/categories/<cat>` will render the author archive.
  */
 function add_rewrite() {
 	add_rewrite_rule( '^my-patterns/[^/]+/?$', 'index.php?pagename=my-patterns', 'top' );
 	add_rewrite_rule( '^favorites/.+/?$', 'index.php?pagename=favorites', 'top' );
+	add_rewrite_endpoint( 'categories', EP_AUTHORS );
 }
 
Index: /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/header.php
===================================================================
--- /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/header.php	(revision 11163)
+++ /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/header.php	(revision 11164)
@@ -33,5 +33,10 @@
 						<p class="site-description"><?php esc_html_e( 'Add a beautifully designed, ready to go layout to any WordPress site with a simple copy/paste.', 'wporg-patterns' ); ?></p>
 						<?php get_search_form(); ?>
-						<a class="site-link" href="<?php echo esc_url( home_url( '/favorites' ) ); ?>"><?php esc_html_e( 'Favorites', 'wporg-patterns' ); ?></a>
+
+						<?php if ( is_user_logged_in() ) : ?>
+							<a class="site-link" href="<?php echo esc_url( home_url( '/favorites' ) ); ?>"><?php esc_html_e( 'Favorites', 'wporg-patterns' ); ?></a>
+						<?php else : ?>
+							<a class="site-link" href="<?php echo esc_url( wp_login_url() ); ?>"><?php esc_html_e( 'Log in to collect your favorites', 'wporg-patterns' ); ?></a>
+						<?php endif; ?>
 					</div>
 				<?php else : ?>
Index: /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/breadcrumb-monitor/index.js
===================================================================
--- /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/breadcrumb-monitor/index.js	(revision 11163)
+++ /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/breadcrumb-monitor/index.js	(revision 11164)
@@ -27,11 +27,9 @@
 	const { path } = useRoute();
 
-	const { authorName, categoryName, query } = useSelect( ( select ) => {
+	const { authorName, categoryName } = useSelect( ( select ) => {
 		const _query = select( patternStore ).getQueryFromUrl( path );
 		const category = select( patternStore ).getCategoryById( _query[ 'pattern-categories' ] );
 		return {
-			query: _query,
-			// @todo Get the author's display name.
-			authorName: _query?.author_name,
+			authorName: wporgPatternsData.currentAuthorName || _query?.author_name,
 			categoryName: category?.name,
 		};
@@ -41,5 +39,5 @@
 		if ( authorName ) {
 			// translators: %s is the author name.
-			setBreadcrumbText( sprintf( __( 'Author: %s', 'wporg-patterns' ), query.author_name ) );
+			setBreadcrumbText( sprintf( __( 'Author: %s', 'wporg-patterns' ), authorName ) );
 		} else if ( categoryName ) {
 			// translators: %s is the category name.
Index: /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/context-bar/index.js
===================================================================
--- /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/context-bar/index.js	(revision 11163)
+++ /sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/context-bar/index.js	(revision 11164)
@@ -65,5 +65,5 @@
 
 			return {
-				author: _query?.author_name,
+				author: wporgPatternsData.currentAuthorName || _query?.author_name,
 				category: getCategoryById( _query[ 'pattern-categories' ] ),
 				count: getPatternTotalsByQuery( _query ),
