WordPress.org

Making WordPress.org

Changeset 11138


Ignore:
Timestamp:
07/20/2021 03:14:08 PM (2 months ago)
Author:
ryelle
Message:

Pattern Directory: Sync with git WordPress/pattern-directory@f532a628b49398708ab7e00d46a3ce4be2b4451b

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.asset.php

    r11137 r11138  
    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' => '1a2f824953a82f83723b6428397bfe53');
     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' => '2f74fc593b65910396a5d537efa25169');
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.js

    r11137 r11138  
    1 !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)&&r.length){var c=a.apply(null,r);c&&e.push(c)}else if("object"===o)for(var i in r)n.call(r,i)&&r[i]&&e.push(i)}}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 N})),n.d(r,"loadPattern",(function(){return k})),n.d(r,"loadPatterns",(function(){return C})),n.d(r,"setErrorPatterns",(function(){return A})),n.d(r,"setCurrentQuery",(function(){return I})),n.d(r,"fetchCategories",(function(){return L})),n.d(r,"loadCategories",(function(){return R})),n.d(r,"fetchPatternFlagReasons",(function(){return D})),n.d(r,"loadPatternFlagReasons",(function(){return F})),n.d(r,"loadFavorites",(function(){return M})),n.d(r,"addFavorite",(function(){return B})),n.d(r,"removeFavorite",(function(){return Q}));var a={};n.r(a),n.d(a,"getPatternsByQuery",(function(){return H})),n.d(a,"getPattern",(function(){return $})),n.d(a,"getCategories",(function(){return z})),n.d(a,"getPatternFlagReasons",(function(){return W})),n.d(a,"getFavorites",(function(){return Y}));var o={};n.r(o),n.d(o,"isLoadingPatternsByQuery",(function(){return X})),n.d(o,"getPatterns",(function(){return J})),n.d(o,"getPatternsByQuery",(function(){return Z})),n.d(o,"getPatternTotalsByQuery",(function(){return ee})),n.d(o,"getPatternTotalPagesByQuery",(function(){return te})),n.d(o,"getPattern",(function(){return ne})),n.d(o,"getCurrentQuery",(function(){return re})),n.d(o,"isLoadingCategories",(function(){return ae})),n.d(o,"hasLoadedCategories",(function(){return oe})),n.d(o,"getCategories",(function(){return ce})),n.d(o,"getCategoryBySlug",(function(){return ie})),n.d(o,"getPatternFlagReasons",(function(){return se})),n.d(o,"isLoadingPatternFlagReasons",(function(){return le})),n.d(o,"getFavorites",(function(){return ue})),n.d(o,"isFavorite",(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),f=n.n(d),m=n(9),b=function(e){return Object(c.createElement)(m.SVG,f()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),Object(c.createElement)(m.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 g(e){return e*(2/3)}const v=()=>{const[e,t]=Object(c.useState)(),n=Object(c.useRef)();return Object(c.useEffect)(()=>{n.current&&t(g(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)(b,{width:"16px",height:"16px",fill:"#787c82",className:"pattern-favorite-button__filled"}),Object(c.createElement)(p,{height:"12px",width:"32px",marginLeft:"0.5rem"}))))};var h=({length:e=6})=>Array(e).fill().map((e,t)=>Object(c.createElement)(v,{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]||""},_=e=>j(e,"pattern-categories"),w=e=>decodeURI(j(e,"search")),E=Object(c.createContext)();function S({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)(E.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 P(){const e=Object(c.useContext)(E);if(void 0===e)throw new Error("useRoute must be used within a Provider");return e}function x({currentPage:e=1,totalPages:t}){const{path:n,update:r}=P();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),f=(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=>f(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=>f(e,t)},Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.sprintf)(// translators: %s is the page number.
    2 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=>f(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 T=n(6);function N(e){return{type:"FETCH_BLOCK_PATTERNS",query:e}}function k(e,t){return{type:"LOAD_BLOCK_PATTERN",postId:e,pattern:t}}function C(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 A(e,{page:t,error:n}){return{type:"ERROR_BLOCK_PATTERNS",query:e,page:t,error:n}}function I(e){return{type:"SET_CURRENT_QUERY",query:e}}function L(){return{type:"FETCH_CATEGORIES"}}function R(e){return{type:"LOAD_CATEGORIES",categories:e}}function D(){return{type:"FETCH_PATTERN_FLAG_REASONS"}}function F(e){return{type:"LOAD_PATTERN_FLAG_REASONS",reasons:e}}function M(e){return{type:"LOAD_FAVORITES",patternIds:e}}function*B(e){const t=yield Object(T.apiFetch)({path:"/wporg/v1/pattern-favorites",method:"POST",data:{id:e}});if("number"==typeof t)return{type:"ADD_FAVORITE",patternId:e,count:t}}function*Q(e){const t=yield Object(T.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 K(){return{id:-1,slug:"",name:Object(i.__)("All","wporg-patterns"),link:wporgPatternsUrl.site}}function V(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 G(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 U=Object(s.combineReducers)({patterns:function(e={},t){return{byId:V(e.byId,t),queries:G(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[K(),...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*H(e){const t=q(e);try{yield N(t);const n=yield Object(T.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern",{...e,locale:JSON.parse(wporgLocale)}),parse:!1}),{total:r,totalPages:a,results:o}=yield Object(T.__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 C(t,{page:e.page||1,patterns:o,total:r,totalPages:a})}catch(n){const r=yield Object(T.__unstableAwaitPromise)(async function(e){try{return await e.json()}catch(e){return{}}}(n));yield A(t,{page:e.page||1,error:r})}}function*$(e){try{const t=yield Object(T.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern/"+e)});yield k(e,t)}catch(e){}}function*z(){try{yield{type:"FETCH_CATEGORIES"};const e=yield Object(T.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/pattern-categories")});yield R(e)}catch(e){}}function*W(){try{yield{type:"FETCH_PATTERN_FLAG_REASONS"};const e=yield Object(T.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern-flag-reason")});yield F(e)}catch(e){}}function*Y(){try{const e=yield Object(T.apiFetch)({path:"/wporg/v1/pattern-favorites"});yield M(e)}catch(e){}}function X(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 J(e){return Object.values(e.patterns.byId)}function Z(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 ee(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 te(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 ne(e,t){return e.patterns.byId[t]||null}function re(e){return e.currentQuery}function ae(e){return null===e.categories}function oe(e){return Array.isArray(e.categories)}function ce(e){return e.categories}function ie(e,t){if(!oe(e))return;const[n]=e.categories.filter(e=>e.slug===t);return n}function se(e){return e.patternFlagReasons}function le(e){return null===e.patternFlagReasons}function ue(e){return e.favorites}function pe(e,t){var n;return null===(n=e.favorites)||void 0===n?void 0:n.includes(t)}const de=Object(s.createReduxStore)("wporg/pattern-directory",{reducer:U,selectors:o,actions:r,controls:T.controls,resolvers:a});Object(s.register)(de);var fe=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)(h,{length:null==n?void 0:n.per_page}):o.map(t)),r&&Object(c.createElement)(x,{totalPages:i,currentPage:null==n?void 0:n.page}))},me=n(8),be=n(4);function ge(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 ve=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),ge(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),ge(n),p(n),!0)}t&&(n()||t.addEventListener("load",()=>{n()}))},[]);return Object(c.createElement)("iframe",f()({title:Object(i.__)("Pattern Preview","wporg-patterns"),tabIndex:"-1"},s,{ref:Object(me.useMergeRefs)([l,d])}),u&&Object(c.createPortal)(t,u.body),u&&Object(c.createPortal)(n,u.head))})),he=function({html:e}){return Object(c.createElement)("div",null,Object(c.createElement)(ve,{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 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 Be(e){return"pointerId"in e?null:"touchend"===e.type?e.changedTouches:e.targetTouches}function Qe(e){return Array.from(Be(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 Ve(e,t){void 0===t&&(t=Ke);var n=Be(e),r=n?n[0]:e;return t([r.clientX,r.clientY])}var Ge=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 Ge.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]]}}),Ue="undefined"!=typeof window&&window.document&&window.document.createElement,He={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=Ue?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},$e=Te({},Ge,{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,He));return i.drag=function(e){return void 0===e&&(e={}),Fe(e,$e)}(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,f=_e(s(o.threshold),s([0,0])).map(Math.abs),m=Te({},Ye()[c],{_active:!0,args:i,values:t,initial:null!=r?r:t,_threshold:f,offset:l,lastOffset:l,startTime:u});return Te({},m,{_initial:De(p,m),_bounds:De(d,m)})}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&&mt(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){mt(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(Qe(t))}function ot(e,t){"pointerId"in t?e.pointerIds.delete(t.pointerId):Qe(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&&(mt(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&&(mt(a.window,o[t],r),ft(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;mt(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)])}ft(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 ft(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 mt(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 bt(){}function gt(e){"persist"in e&&"function"==typeof e.persist&&e.persist()}var vt=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){gt(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,gt(e),t.setTimeout(t.startDrag.bind(ke(t)),t.config.delay,e)},t.setStartState=function(e){var n=Ve(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=Ve(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,f=d[0],m=d[1],b=t.config.swipeDistance,g=b[0],v=b[1],h=t.config.swipeDuration,O=Te({},tt(ke(t),e),t.getMovement(t.state.values)),y=[0,0];O.elapsedTime<h&&(!1!==u&&Math.abs(a)>f&&Math.abs(i)>g&&(y[0]=Ee(a)),!1!==p&&Math.abs(o)>m&&Math.abs(s)>v&&(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],f=this.checkIntentionality([p,d],u);if(f._blocked)return Te({},f,{_movement:u,delta:[0,0]});var m=f._intentional,b=u,g=[!1!==m[0]?u[0]-m[0]:0,!1!==m[1]?u[1]-m[1]:0],v=je(g,i),h=o?t:[0,0];return g=et(r,je(g,a),h),Te({},f,{intentional:!1!==m[0]||!1!==m[1],_initial:a,_movement:b,movement:g,values:e,offset:et(r,v,h),delta:_e(g,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 ht(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",vt);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,ht)),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?bt: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",f()({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(me.useViewportMatch)("mobile",">="),r=Object(me.useViewportMatch)("large",">="),a=Object(me.useViewportMatch)("wide",">="),o=Object(me.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:"Full (1200px)",value:1200},{label:"Default (960px)",value:960},{label:"Medium (480px)",value:480},{label:"Narrow (320px)",value:320}]:r?[{label:"Default (960px)",value:960},{label:"Medium (480px)",value:480},{label:"Narrow (320px)",value:320}]:[{label:Object(i.__)("Medium (480px)","wporg-patterns"),value:480},{label:Object(i.__)("Narrow (320px)","wporg-patterns"),value:320}]:[],[n,r,a]);let f=!1;if(!d.some(e=>e.value===s)){const e=Math.max(Math.floor(s),280);f={
     1!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 N})),n.d(r,"loadPattern",(function(){return k})),n.d(r,"loadPatterns",(function(){return C})),n.d(r,"setErrorPatterns",(function(){return A})),n.d(r,"setCurrentQuery",(function(){return I})),n.d(r,"fetchCategories",(function(){return L})),n.d(r,"loadCategories",(function(){return R})),n.d(r,"fetchPatternFlagReasons",(function(){return D})),n.d(r,"loadPatternFlagReasons",(function(){return F})),n.d(r,"loadFavorites",(function(){return M})),n.d(r,"addFavorite",(function(){return B})),n.d(r,"removeFavorite",(function(){return Q}));var a={};n.r(a),n.d(a,"getPatternsByQuery",(function(){return H})),n.d(a,"getPattern",(function(){return $})),n.d(a,"getCategories",(function(){return z})),n.d(a,"getPatternFlagReasons",(function(){return W})),n.d(a,"getFavorites",(function(){return Y}));var o={};n.r(o),n.d(o,"isLoadingPatternsByQuery",(function(){return X})),n.d(o,"getPatterns",(function(){return J})),n.d(o,"getPatternsByQuery",(function(){return Z})),n.d(o,"getPatternTotalsByQuery",(function(){return ee})),n.d(o,"getPatternTotalPagesByQuery",(function(){return te})),n.d(o,"getPattern",(function(){return ne})),n.d(o,"getCurrentQuery",(function(){return re})),n.d(o,"isLoadingCategories",(function(){return ae})),n.d(o,"hasLoadedCategories",(function(){return oe})),n.d(o,"getCategories",(function(){return ce})),n.d(o,"getCategoryBySlug",(function(){return ie})),n.d(o,"getPatternFlagReasons",(function(){return se})),n.d(o,"isLoadingPatternFlagReasons",(function(){return le})),n.d(o,"getFavorites",(function(){return ue})),n.d(o,"isFavorite",(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),f=n.n(d),b=n(9),m=function(e){return Object(c.createElement)(b.SVG,f()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),Object(c.createElement)(b.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 g(e){return e*(2/3)}const v=()=>{const[e,t]=Object(c.useState)(),n=Object(c.useRef)();return Object(c.useEffect)(()=>{n.current&&t(g(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)(m,{width:"16px",height:"16px",fill:"#787c82",className:"pattern-favorite-button__filled"}),Object(c.createElement)(p,{height:"12px",width:"32px",marginLeft:"0.5rem"}))))};var h=({length:e=6})=>Array(e).fill().map((e,t)=>Object(c.createElement)(v,{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]||""},_=e=>j(e,"pattern-categories"),w=e=>decodeURI(j(e,"search")),E=Object(c.createContext)();function S({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)(E.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 P(){const e=Object(c.useContext)(E);if(void 0===e)throw new Error("useRoute must be used within a Provider");return e}function x({currentPage:e=1,totalPages:t}){const{path:n,update:r}=P();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),f=(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=>f(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=>f(e,t)},Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.sprintf)(// translators: %s is the page number.
     2Object(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=>f(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 T=n(6);function N(e){return{type:"FETCH_BLOCK_PATTERNS",query:e}}function k(e,t){return{type:"LOAD_BLOCK_PATTERN",postId:e,pattern:t}}function C(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 A(e,{page:t,error:n}){return{type:"ERROR_BLOCK_PATTERNS",query:e,page:t,error:n}}function I(e){return{type:"SET_CURRENT_QUERY",query:e}}function L(){return{type:"FETCH_CATEGORIES"}}function R(e){return{type:"LOAD_CATEGORIES",categories:e}}function D(){return{type:"FETCH_PATTERN_FLAG_REASONS"}}function F(e){return{type:"LOAD_PATTERN_FLAG_REASONS",reasons:e}}function M(e){return{type:"LOAD_FAVORITES",patternIds:e}}function*B(e){const t=yield Object(T.apiFetch)({path:"/wporg/v1/pattern-favorites",method:"POST",data:{id:e}});if("number"==typeof t)return{type:"ADD_FAVORITE",patternId:e,count:t}}function*Q(e){const t=yield Object(T.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 K(){return{id:-1,slug:"",name:Object(i.__)("All","wporg-patterns"),link:wporgPatternsUrl.site}}function V(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 G(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 U=Object(s.combineReducers)({patterns:function(e={},t){return{byId:V(e.byId,t),queries:G(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[K(),...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*H(e){const t=q(e);try{yield N(t);const n=yield Object(T.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern",{...e,locale:JSON.parse(wporgLocale)}),parse:!1}),{total:r,totalPages:a,results:o}=yield Object(T.__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 C(t,{page:e.page||1,patterns:o,total:r,totalPages:a})}catch(n){const r=yield Object(T.__unstableAwaitPromise)(async function(e){try{return await e.json()}catch(e){return{}}}(n));yield A(t,{page:e.page||1,error:r})}}function*$(e){try{const t=yield Object(T.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern/"+e)});yield k(e,t)}catch(e){}}function*z(){try{yield{type:"FETCH_CATEGORIES"};const e=yield Object(T.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/pattern-categories")});yield R(e)}catch(e){}}function*W(){try{yield{type:"FETCH_PATTERN_FLAG_REASONS"};const e=yield Object(T.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern-flag-reason")});yield F(e)}catch(e){}}function*Y(){try{const e=yield Object(T.apiFetch)({path:"/wporg/v1/pattern-favorites"});yield M(e)}catch(e){}}function X(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 J(e){return Object.values(e.patterns.byId)}function Z(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 ee(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 te(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 ne(e,t){return e.patterns.byId[t]||null}function re(e){return e.currentQuery}function ae(e){return null===e.categories}function oe(e){return Array.isArray(e.categories)}function ce(e){return e.categories}function ie(e,t){if(!oe(e))return;const[n]=e.categories.filter(e=>e.slug===t);return n}function se(e){return e.patternFlagReasons}function le(e){return null===e.patternFlagReasons}function ue(e){return e.favorites}function pe(e,t){var n;return null===(n=e.favorites)||void 0===n?void 0:n.includes(t)}const de=Object(s.createReduxStore)("wporg/pattern-directory",{reducer:U,selectors:o,actions:r,controls:T.controls,resolvers:a});Object(s.register)(de);var fe=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)(h,{length:null==n?void 0:n.per_page}):o.map(t)),r&&Object(c.createElement)(x,{totalPages:i,currentPage:null==n?void 0:n.page}))},be=n(8),me=n(4);function ge(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 ve=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),ge(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),ge(n),p(n),!0)}t&&(n()||t.addEventListener("load",()=>{n()}))},[]);return Object(c.createElement)("iframe",f()({title:Object(i.__)("Pattern Preview","wporg-patterns"),tabIndex:"-1"},s,{ref:Object(be.useMergeRefs)([l,d])}),u&&Object(c.createPortal)(t,u.body),u&&Object(c.createPortal)(n,u.head))})),he=function({html:e}){return Object(c.createElement)("div",null,Object(c.createElement)(ve,{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 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 Be(e){return"pointerId"in e?null:"touchend"===e.type?e.changedTouches:e.targetTouches}function Qe(e){return Array.from(Be(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 Ve(e,t){void 0===t&&(t=Ke);var n=Be(e),r=n?n[0]:e;return t([r.clientX,r.clientY])}var Ge=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 Ge.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]]}}),Ue="undefined"!=typeof window&&window.document&&window.document.createElement,He={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=Ue?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},$e=Te({},Ge,{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,He));return i.drag=function(e){return void 0===e&&(e={}),Fe(e,$e)}(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,f=_e(s(o.threshold),s([0,0])).map(Math.abs),b=Te({},Ye()[c],{_active:!0,args:i,values:t,initial:null!=r?r:t,_threshold:f,offset:l,lastOffset:l,startTime:u});return Te({},b,{_initial:De(p,b),_bounds:De(d,b)})}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&&bt(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){bt(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(Qe(t))}function ot(e,t){"pointerId"in t?e.pointerIds.delete(t.pointerId):Qe(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&&(bt(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&&(bt(a.window,o[t],r),ft(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;bt(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)])}ft(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 ft(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 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.removeEventListener(c,i,n)}}function mt(){}function gt(e){"persist"in e&&"function"==typeof e.persist&&e.persist()}var vt=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){gt(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,gt(e),t.setTimeout(t.startDrag.bind(ke(t)),t.config.delay,e)},t.setStartState=function(e){var n=Ve(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=Ve(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,f=d[0],b=d[1],m=t.config.swipeDistance,g=m[0],v=m[1],h=t.config.swipeDuration,O=Te({},tt(ke(t),e),t.getMovement(t.state.values)),y=[0,0];O.elapsedTime<h&&(!1!==u&&Math.abs(a)>f&&Math.abs(i)>g&&(y[0]=Ee(a)),!1!==p&&Math.abs(o)>b&&Math.abs(s)>v&&(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],f=this.checkIntentionality([p,d],u);if(f._blocked)return Te({},f,{_movement:u,delta:[0,0]});var b=f._intentional,m=u,g=[!1!==b[0]?u[0]-b[0]:0,!1!==b[1]?u[1]-b[1]:0],v=je(g,i),h=o?t:[0,0];return g=et(r,je(g,a),h),Te({},f,{intentional:!1!==b[0]||!1!==b[1],_initial:a,_movement:m,movement:g,values:e,offset:et(r,v,h),delta:_e(g,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 ht(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",vt);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,ht)),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?mt: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",f()({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(be.useViewportMatch)("mobile",">="),r=Object(be.useViewportMatch)("large",">="),a=Object(be.useViewportMatch)("wide",">="),o=Object(be.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 f=!1;if(!d.some(e=>e.value===s)){const e=Math.max(Math.floor(s),280);f={
    33/* translators: %s is the width in pixels, ex 600. */
    4 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)(be.SelectControl,{hideLabelFromVision:!0,label:Object(i.__)("Preview Width","wporg-patterns"),value:s,options:f?[f,...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)(he,{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)(be.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)(be.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)(m.SVG,f()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),Object(c.createElement)(m.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)(b,{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)(be.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)(be.Animate,{type:"appear",options:{origin:"bottom"}},({className:t})=>Object(c.createElement)(be.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(g(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:g(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)(ve,{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)(b,{className:"pattern-favorite-button__filled"}),Object(c.createElement)("span",null,t)):Object(c.createElement)("span",{className:u},Object(c.createElement)(b,{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)(be.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)("div",{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)(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)(
     4label: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)(me.SelectControl,{hideLabelFromVision:!0,label:Object(i.__)("Preview Width","wporg-patterns"),value:s,options:f?[f,...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)(he,{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)(me.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)(me.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)(b.SVG,f()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),Object(c.createElement)(b.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)(m,{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)(me.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)(me.Animate,{type:"appear",options:{origin:"bottom"}},({className:t})=>Object(c.createElement)(me.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(g(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:g(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)(ve,{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)(m,{className:"pattern-favorite-button__filled"}),Object(c.createElement)("span",null,t)):Object(c.createElement)("span",{className:u},Object(c.createElement)(m,{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)(me.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)("div",{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)(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)(
    55/* translators: %s is the favorite count for a pattern. */
    6 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})},Bt=Object(c.createElement)(m.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(m.Path,{d:"M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"})),Qt=n(16),qt=n.n(Qt);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 Vt=({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:f,mappedReasons:m}=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()}))}}),b=()=>{t(n.isSubmitted)};return Object(c.createElement)(be.Modal,{className:"pattern-report-modal "+(n.isSubmitted?"":"pattern-report-modal__has-fixed-height"),title:Object(i.__)("Report this pattern","wporg-patterns"),onRequestClose:b},Object(c.createElement)("div",{ref:p},f?Object(c.createElement)(be.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)(
     6Object(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})},Bt=Object(c.createElement)(b.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(b.Path,{d:"M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"})),Qt=n(16),qt=n.n(Qt);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 Vt=({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:f,mappedReasons:b}=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()}))}}),m=()=>{t(n.isSubmitted)};return Object(c.createElement)(me.Modal,{className:"pattern-report-modal "+(n.isSubmitted?"":"pattern-report-modal__has-fixed-height"),title:Object(i.__)("Report this pattern","wporg-patterns"),onRequestClose:m},Object(c.createElement)("div",{ref:p},f?Object(c.createElement)(me.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)(
    77/* translators: %s: Error message. */
    8 Object(i.__)("Error: %s","wporg-patterns"),e.message))}))}},Object(c.createElement)(be.RadioControl,{className:"pattern-report-modal__radio",label:Object(i.__)("Please choose a reason:","wporg-patterns"),selected:a,options:m,onChange:o,required:!0}),Object(c.createElement)(be.TextareaControl,{label:"Please provide details (required)",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)(be.Button,{isSecondary:!0,onClick:b},Object(i.__)("Cancel","wporg-patterns")),Object(c.createElement)(be.Button,{type:"submit",isBusy:n.isSubmitting,isPrimary:!0},n.isSubmitting?Object(i.__)("Submitting …","wporg-patterns"):Object(i.__)("Report","wporg-patterns"))))))},Gt=({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:Bt}),Object(i.__)("You've reported this pattern","wporg-patterns")):l?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(be.Button,{className:"pattern-report-button",isLink:!0,onClick:()=>r(!0)},Object(i.__)("Report this pattern","wporg-patterns")),n&&Object(c.createElement)(Vt,{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")))},Ut=({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)(Gt,{userHasReported:"true"===t,postId:e}))),Object(c.createElement)("div",{className:"entry-content"},Object(c.createElement)(fe,{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},Ht=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})})))},$t=function({query:e}){const{path:t}=P(),[n,r]=Object(c.useState)(),[a,o]=Object(c.useState)(),[l]=Object(c.useState)({title:"",links:[]}),u=Object(c.useRef)(null),{isAllCategory:p,category:d,count:f,isLoadingPatterns:m}=Object(s.useSelect)(n=>{const{getCategoryBySlug:r,isLoadingPatternsByQuery:a,getPatternTotalsByQuery:o}=n(de),c=r(_(t));return{isAllCategory:c&&-1===c.id,isLoadingPatterns:a(e),category:c,count:o(e)}},[t,e]);Object(c.useEffect)(()=>{if(m)return void o(d?(e=d.name,Object(c.createInterpolateElement)(Object(i.sprintf)(
     8Object(i.__)("Error: %s","wporg-patterns"),e.message))}))}},Object(c.createElement)(me.RadioControl,{className:"pattern-report-modal__radio",label:Object(i.__)("Please choose a reason:","wporg-patterns"),selected:a,options:b,onChange:o,required:!0}),Object(c.createElement)(me.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)(me.Button,{isSecondary:!0,onClick:m},Object(i.__)("Cancel","wporg-patterns")),Object(c.createElement)(me.Button,{type:"submit",isBusy:n.isSubmitting,isPrimary:!0},n.isSubmitting?Object(i.__)("Submitting …","wporg-patterns"):Object(i.__)("Report","wporg-patterns"))))))},Gt=({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:Bt}),Object(i.__)("You've reported this pattern","wporg-patterns")):l?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(me.Button,{className:"pattern-report-button",isLink:!0,onClick:()=>r(!0)},Object(i.__)("Report this pattern","wporg-patterns")),n&&Object(c.createElement)(Vt,{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")))},Ut=({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)(Gt,{userHasReported:"true"===t,postId:e}))),Object(c.createElement)("div",{className:"entry-content"},Object(c.createElement)(fe,{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},Ht=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})})))},$t=function({query:e}){const{path:t}=P(),[n,r]=Object(c.useState)(),[a,o]=Object(c.useState)(),[l]=Object(c.useState)({title:"",links:[]}),u=Object(c.useRef)(null),{isAllCategory:p,category:d,count:f,isLoadingPatterns:b}=Object(s.useSelect)(n=>{const{getCategoryBySlug:r,isLoadingPatternsByQuery:a,getPatternTotalsByQuery:o}=n(de),c=r(_(t));return{isAllCategory:c&&-1===c.id,isLoadingPatterns:a(e),category:c,count:o(e)}},[t,e]);Object(c.useEffect)(()=>{if(b)return void o(d?(e=d.name,Object(c.createInterpolateElement)(Object(i.sprintf)(
    99/* translators: %s category name. */
    1010Object(i.__)("Loading <b>%s</b> patterns.","wporg-patterns"),e,"wporg-patterns"),{b:Object(c.createElement)("b",null)})):Object(i.__)("Loading patterns","wporg-patterns"));var e;if(p)return void o("");d&&o(((e,t)=>Object(c.createInterpolateElement)(Object(i.sprintf)(
     
    1212Object(i._n)("%1$d <b>%2$s</b> pattern.","%1$d <b>%2$s</b> patterns.",e,"wporg-patterns"),e,t,"wporg-patterns"),{b:Object(c.createElement)("b",null)}))(f,d.name));const n=w(t);n.length>0&&o(((e,t)=>Object(c.createInterpolateElement)(Object(i.sprintf)(
    1313/* translators: %1$d: number of patterns. %2$s search term.  */
    14 Object(i._n)("%1$d pattern found for <b>%2$s</b>","%1$d patterns found for <b>%2$s</b>",e,"wporg-patterns"),e,t,"wporg-patterns"),{b:Object(c.createElement)("b",null)}))(f,n))},[d,m]),Object(c.useEffect)(()=>{const e=a?u.current.offsetHeight:0;r(e)},[a]);const b=wt()({"category-context-bar__spinner":!0,"category-context-bar__spinner--is-hidden":!m});return Object(c.createElement)("header",{className:"category-context-bar",style:{height:n+"px"}},Object(c.createElement)("div",{ref:u},Object(c.createElement)("h2",{className:"category-context-bar__copy"},Object(c.createElement)("span",{className:b},Object(c.createElement)(be.Spinner,null)),Object(c.createElement)("span",null,a)),l.links&&l.links.length>0&&Object(c.createElement)("div",{className:"category-context-bar__links"},Object(c.createElement)("h3",{className:"category-context-bar__title"},l.title),Object(c.createElement)("ul",null,l.links.map(e=>Object(c.createElement)("li",{key:e.href},Object(c.createElement)("a",{href:e.href},e.label)))))))},zt=({options:e})=>{const{path:t,replace:n}=P(),r=Object(me.useViewportMatch)("medium",">=");return e?Object(c.createElement)("div",{className:"pattern-order-select"},Object(c.createElement)(be.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}))}})):null},Wt=()=>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"}))),Yt=({current:e,isLoading:t,label:n=Object(i.__)("Main Menu","wporg-patterns"),onClick:r,options:a})=>t?Object(c.createElement)(Wt,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,Xt=({onClick:e,options:t,label:n=Object(i.__)("Browse categories","wporg-patterns")})=>{const[r,a]=Object(c.useState)(!1);return Object(c.createElement)(be.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)))))},Jt=e=>Object(me.useViewportMatch)("medium","<")?Object(c.createElement)(Xt,e):Object(c.createElement)(Yt,e),Zt=({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)),en=({basePath:e="/",query:t})=>{const{path:n,update:r}=P(),a=_(n),o=Object(O.getQueryString)(n)?"?"+Object(O.getQueryString)(n):"";e=wporgPatternsUrl.site+e;const{categories:l,isLoading:u}=Object(s.useSelect)(e=>{const{getCategories:t,isLoadingCategories:n}=e(de);return{categories:t(),isLoading:n()}});return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(Zt,{primary:Object(c.createElement)(Jt,{current:a,options:l?l.map(t=>({value:t.slug?`${e}pattern-categories/${t.slug}/${o}`:`${e}${o}`,slug:t.slug,label:t.name})):[],onClick:e=>{e.preventDefault(),r(e.target.pathname)},isLoading:u}),secondary:Object(c.createElement)(zt,{options:[{label:Object(i.__)("Newest","wporg-patterns"),value:"date"},{label:Object(i.__)("Favorites","wporg-patterns"),value:"favorite_count"}]})}),Object(c.createElement)($t,{query:t}))},tn=Object.prototype.hasOwnProperty;function nn(e,t,n){for(n of e.keys())if(rn(n,t))return n}function rn(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--&&rn(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=nn(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=nn(t,a)))return!1;if(!rn(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(tn.call(e,n)&&++r&&!tn.call(t,n))return!1;if(!(n in t)||!rn(e[n],t[n]))return!1}return Object.keys(t).length===r}}return e!=e&&t!=t}var an=function(e,t){return Object(Oe.useEffect)(e,(n=t,r=Object(Oe.useRef)(),a=Object(Oe.useRef)(0),rn(n,r.current)||(r.current=n,a.current+=1),[a.current]));var n,r,a},on=()=>{const{setCurrentQuery:e}=Object(s.useDispatch)(de),{path:t}=P();let n=!0;const r=Object(O.getQueryArgs)(t),a=_(t),o=Object(s.useSelect)(e=>{if(a){n=!1;const{getCategoryBySlug:t,hasLoadedCategories:r}=e(de);if(r()){n=!0;const e=t(a);return(null==e?void 0:e.id)||!1}}return!1},[a]);o&&(r["pattern-categories"]=o);const c=j(t,"author");c&&(r.author_name=c);const i=(e=>Number(j(e,"page")||1))(t);i>1&&(r.page=i);const l=w(t);l.length>0&&(r.search=l);const u=j(t,"my-patterns");return u&&"page"!==u&&(r.status=u),an(()=>{n&&e(r)},[r,n]),null},cn=()=>{const{path:e}=P(),t=_(e),n=Object(s.useSelect)(e=>{const{getCategoryBySlug:n,hasLoadedCategories:r}=e(de);var a;if(r())return(null===(a=n(t))||void 0===a?void 0:a.name)||K().name},[t]),r=j(e,"author");return Object(c.useEffect)(()=>{n&&!r&&(e=>{const t=document.getElementById("breadcrumb-part");if(t){
     14Object(i._n)("%1$d pattern found for <b>%2$s</b>","%1$d patterns found for <b>%2$s</b>",e,"wporg-patterns"),e,t,"wporg-patterns"),{b:Object(c.createElement)("b",null)}))(f,n))},[d,b]),Object(c.useEffect)(()=>{const e=a?u.current.offsetHeight:0;r(e)},[a]);const m=wt()({"category-context-bar__spinner":!0,"category-context-bar__spinner--is-hidden":!b});return Object(c.createElement)("header",{className:"category-context-bar",style:{height:n+"px"}},Object(c.createElement)("div",{ref:u},Object(c.createElement)("h2",{className:"category-context-bar__copy"},Object(c.createElement)("span",{className:m},Object(c.createElement)(me.Spinner,null)),Object(c.createElement)("span",null,a)),l.links&&l.links.length>0&&Object(c.createElement)("div",{className:"category-context-bar__links"},Object(c.createElement)("h3",{className:"category-context-bar__title"},l.title),Object(c.createElement)("ul",null,l.links.map(e=>Object(c.createElement)("li",{key:e.href},Object(c.createElement)("a",{href:e.href},e.label)))))))},zt=({options:e})=>{const{path:t,replace:n}=P(),r=Object(be.useViewportMatch)("medium",">=");return e?Object(c.createElement)("div",{className:"pattern-order-select"},Object(c.createElement)(me.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}))}})):null},Wt=()=>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"}))),Yt=({current:e,isLoading:t,label:n=Object(i.__)("Main Menu","wporg-patterns"),onClick:r,options:a})=>t?Object(c.createElement)(Wt,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,Xt=({onClick:e,options:t,label:n=Object(i.__)("Browse categories","wporg-patterns")})=>{const[r,a]=Object(c.useState)(!1);return Object(c.createElement)(me.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)))))},Jt=e=>Object(be.useViewportMatch)("medium","<")?Object(c.createElement)(Xt,e):Object(c.createElement)(Yt,e),Zt=({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)),en=({basePath:e="/",query:t})=>{const{path:n,update:r}=P(),a=_(n),o=Object(O.getQueryString)(n)?"?"+Object(O.getQueryString)(n):"";e=wporgPatternsUrl.site+e;const{categories:l,isLoading:u}=Object(s.useSelect)(e=>{const{getCategories:t,isLoadingCategories:n}=e(de);return{categories:t(),isLoading:n()}});return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(Zt,{primary:Object(c.createElement)(Jt,{current:a,options:l?l.map(t=>({value:t.slug?`${e}pattern-categories/${t.slug}/${o}`:`${e}${o}`,slug:t.slug,label:t.name})):[],onClick:e=>{e.preventDefault(),r(e.target.pathname)},isLoading:u}),secondary:Object(c.createElement)(zt,{options:[{label:Object(i.__)("Newest","wporg-patterns"),value:"date"},{label:Object(i.__)("Favorites","wporg-patterns"),value:"favorite_count"}]})}),Object(c.createElement)($t,{query:t}))},tn=Object.prototype.hasOwnProperty;function nn(e,t,n){for(n of e.keys())if(rn(n,t))return n}function rn(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--&&rn(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=nn(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=nn(t,a)))return!1;if(!rn(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(tn.call(e,n)&&++r&&!tn.call(t,n))return!1;if(!(n in t)||!rn(e[n],t[n]))return!1}return Object.keys(t).length===r}}return e!=e&&t!=t}var an=function(e,t){return Object(Oe.useEffect)(e,(n=t,r=Object(Oe.useRef)(),a=Object(Oe.useRef)(0),rn(n,r.current)||(r.current=n,a.current+=1),[a.current]));var n,r,a},on=()=>{const{setCurrentQuery:e}=Object(s.useDispatch)(de),{path:t}=P();let n=!0;const r=Object(O.getQueryArgs)(t),a=_(t),o=Object(s.useSelect)(e=>{if(a){n=!1;const{getCategoryBySlug:t,hasLoadedCategories:r}=e(de);if(r()){n=!0;const e=t(a);return(null==e?void 0:e.id)||!1}}return!1},[a]);o&&(r["pattern-categories"]=o);const c=j(t,"author");c&&(r.author_name=c);const i=(e=>Number(j(e,"page")||1))(t);i>1&&(r.page=i);const l=w(t);l.length>0&&(r.search=l);const u=j(t,"my-patterns");return u&&"page"!==u&&(r.status=u),an(()=>{n&&e(r)},[r,n]),null},cn=()=>{const{path:e}=P(),t=_(e),n=Object(s.useSelect)(e=>{const{getCategoryBySlug:n,hasLoadedCategories:r}=e(de);var a;if(r())return(null===(a=n(t))||void 0===a?void 0:a.name)||K().name},[t]),r=j(e,"author");return Object(c.useEffect)(()=>{n&&!r&&(e=>{const t=document.getElementById("breadcrumb-part");if(t){
    1515// translators: %s is the category name.
    16 const n=Object(i.sprintf)(Object(i.__)("Category: %s","wporg-patterns"),e);t.innerText=n}})(n)},[e]),null},sn=function(){return Object(c.createElement)("div",{className:"pattern-grid__empty-header"},Object(c.createElement)("h2",null,Object(i.__)("No favorites here","wporg-patterns")),Object(c.createElement)("p",null,Object(c.createInterpolateElement)(Object(i.__)("You haven’t favorited any patterns yet. Take a look at the <a>block patterns</a> to find some you like, and click the heart to save them.","wporg-patterns"),{a:Object(c.createElement)("a",{href:wporgPatternsUrl.site})})))},ln=function(){const{path:e,update:t}=P();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)(Jt,{label:Object(i.__)("Menu","wporg-patterns"),current:n||"all",options:r,onClick:e=>{e.preventDefault(),t(e.target.pathname)},isLoading:!1})};const un=document.getElementById("patterns__container");un&&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)(S,null,Object(c.createElement)(on,null),Object(c.createElement)(cn,null),Object(c.createElement)(en,{query:t}),e?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(Ht,null),Object(c.createElement)(fe,{query:{per_page:6},showPagination:!1},e=>Object(c.createElement)(Ft,{key:e.id,pattern:e,showAvatar:!0}))):Object(c.createElement)(fe,{query:t},e=>Object(c.createElement)(Ft,{key:e.id,pattern:e,showAvatar:!0})))},null),un);const pn=document.getElementById("my-patterns__container");pn&&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)(S,null,Object(c.createElement)(on,null),Object(c.createElement)(Zt,{primary:Object(c.createElement)(ln,null),secondary:Object(c.createElement)(zt,{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)(fe,{query:n},e=>Object(c.createElement)(Ft,{key:e.id,pattern:e})))},null),pn);const dn=document.getElementById("my-favorites__container");dn&&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}});if(!wporgPatternsData.userId){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 favorite patterns.","wporg-patterns")),Object(c.createElement)("a",{className:"button button-primary",href:e},Object(i.__)("Log in","wporg-patterns")))}return e?Object(c.createElement)(sn,null):Object(c.createElement)(S,null,Object(c.createElement)(on,null),Object(c.createElement)(en,{basePath:"/my-favorites/",query:t}),Object(c.createElement)(fe,{query:t},e=>Object(c.createElement)(Ft,{key:e.id,pattern:e})))},null),dn);const fn=document.querySelectorAll(".pattern__container");for(let e=0;e<fn.length;e++){const t=fn[e],n=t.dataset;Object(c.render)(Object(c.createElement)(Ut,n),t,()=>{t.hidden=!1,document.querySelectorAll(".hide-if-pattern-loaded").forEach(e=>e.hidden=!0)})}const mn=document.getElementById("patterns-search__container");mn&&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)(S,null,Object(c.createElement)(on,null),Object(c.createElement)($t,{query:t}),e?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(Ht,null),Object(c.createElement)(fe,{query:{per_page:6},showPagination:!1},e=>Object(c.createElement)(Ft,{key:e.id,pattern:e,showAvatar:!0}))):Object(c.createElement)(fe,{query:t},e=>Object(c.createElement)(Ft,{key:e.id,pattern:e,showAvatar:!0})))},mn.dataset),mn)}]);
     16const n=Object(i.sprintf)(Object(i.__)("Category: %s","wporg-patterns"),e);t.innerText=n}})(n)},[e]),null},sn=function(){return Object(c.createElement)("div",{className:"pattern-grid__empty-header"},Object(c.createElement)("h2",null,Object(i.__)("No favorites here","wporg-patterns")),Object(c.createElement)("p",null,Object(c.createInterpolateElement)(Object(i.__)("You haven’t favorited any patterns yet. Take a look at the <a>block patterns</a> to find some you like, and click the heart to save them.","wporg-patterns"),{a:Object(c.createElement)("a",{href:wporgPatternsUrl.site})})))},ln=function(){const{path:e,update:t}=P();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)(Jt,{label:Object(i.__)("Menu","wporg-patterns"),current:n||"all",options:r,onClick:e=>{e.preventDefault(),t(e.target.pathname)},isLoading:!1})};const un=document.getElementById("patterns__container");un&&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)(S,null,Object(c.createElement)(on,null),Object(c.createElement)(cn,null),Object(c.createElement)(en,{query:t}),e?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(Ht,null),Object(c.createElement)(fe,{query:{per_page:6},showPagination:!1},e=>Object(c.createElement)(Ft,{key:e.id,pattern:e,showAvatar:!0}))):Object(c.createElement)(fe,{query:t},e=>Object(c.createElement)(Ft,{key:e.id,pattern:e,showAvatar:!0})))},null),un);const pn=document.getElementById("my-patterns__container");pn&&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)(S,null,Object(c.createElement)(on,null),Object(c.createElement)(Zt,{primary:Object(c.createElement)(ln,null),secondary:Object(c.createElement)(zt,{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)(fe,{query:n},e=>Object(c.createElement)(Ft,{key:e.id,pattern:e})))},null),pn);const dn=document.getElementById("my-favorites__container");dn&&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}});if(!wporgPatternsData.userId){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 favorite patterns.","wporg-patterns")),Object(c.createElement)("a",{className:"button button-primary",href:e},Object(i.__)("Log in","wporg-patterns")))}return e?Object(c.createElement)(sn,null):Object(c.createElement)(S,null,Object(c.createElement)(on,null),Object(c.createElement)(en,{basePath:"/my-favorites/",query:t}),Object(c.createElement)(fe,{query:t},e=>Object(c.createElement)(Ft,{key:e.id,pattern:e})))},null),dn);const fn=document.querySelectorAll(".pattern__container");for(let e=0;e<fn.length;e++){const t=fn[e],n=t.dataset;Object(c.render)(Object(c.createElement)(Ut,n),t,()=>{t.hidden=!1,document.querySelectorAll(".hide-if-pattern-loaded").forEach(e=>e.hidden=!0)})}const bn=document.getElementById("patterns-search__container");bn&&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)(S,null,Object(c.createElement)(on,null),Object(c.createElement)($t,{query:t}),e?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(Ht,null),Object(c.createElement)(fe,{query:{per_page:6},showPagination:!1},e=>Object(c.createElement)(Ft,{key:e.id,pattern:e,showAvatar:!0}))):Object(c.createElement)(fe,{query:t},e=>Object(c.createElement)(Ft,{key:e.id,pattern:e,showAvatar:!0})))},bn.dataset),bn)}]);
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/pattern-preview/index.js

    r11113 r11138  
    4141            // More than 1280 wide.
    4242            return [
    43                 { label: 'Full (1200px)', value: 1200 },
    44                 { label: 'Default (960px)', value: 960 },
    45                 { label: 'Medium (480px)', value: 480 },
    46                 { label: 'Narrow (320px)', value: 320 },
     43                { label: __( 'Full (1200px)', 'wporg-patterns' ), value: 1200 },
     44                { label: __( 'Default (960px)', 'wporg-patterns' ), value: 960 },
     45                { label: __( 'Medium (480px)', 'wporg-patterns' ), value: 480 },
     46                { label: __( 'Narrow (320px)', 'wporg-patterns' ), value: 320 },
    4747            ];
    4848        } else if ( showViewportControlDefault ) {
    4949            // Less than 1280, more than 960.
    5050            return [
    51                 { label: 'Default (960px)', value: 960 },
    52                 { label: 'Medium (480px)', value: 480 },
    53                 { label: 'Narrow (320px)', value: 320 },
     51                { label: __( 'Default (960px)', 'wporg-patterns' ), value: 960 },
     52                { label: __( 'Medium (480px)', 'wporg-patterns' ), value: 480 },
     53                { label: __( 'Narrow (320px)', 'wporg-patterns' ), value: 320 },
    5454            ];
    5555        }
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/report-pattern-modal/index.js

    r11111 r11138  
    124124                />
    125125                <TextareaControl
    126                     label="Please provide details (required)"
     126                    label={ __( 'Please provide details (required)', 'wporg-patterns' ) }
    127127                    value={ details }
    128128                    onChange={ setDetails }
Note: See TracChangeset for help on using the changeset viewer.