<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[12525] sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns: Pattern Directory: Sync with git WordPress/pattern-directory@47cf3b4</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/12525">12525</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/12525","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>ryelle</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2023-04-03 21:02:06 +0000 (Mon, 03 Apr 2023)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Pattern Directory: Sync with git WordPress/pattern-directory@47cf3b4</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpatternsbuildindexassetphp">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.asset.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpatternsbuildindexjs">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.js</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpatternssrccomponentspatternthumbnailscreenshotjs">sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/pattern-thumbnail/screenshot.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpatternsbuildindexassetphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.asset.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.asset.php  2023-04-03 05:26:02 UTC (rev 12524)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.asset.php    2023-04-03 21:02:06 UTC (rev 12525)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?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-dom', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-primitives', 'wp-url'), 'version' => 'dbd8c00fbeb433887a4a');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?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-dom', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-primitives', 'wp-url'), 'version' => 'd92e6bc7af43b24ba422');
</ins></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpatternsbuildindexjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.js 2023-04-03 05:26:02 UTC (rev 12524)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.js   2023-04-03 21:02:06 UTC (rev 12525)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,9 +1,9 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-(()=>{var e={472:(e,t)=>{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 i=a.apply(null,r);i&&e.push(i)}}else if("object"===o){if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]")){e.push(r.toString());continue}for(var s in r)n.call(r,s)&&r[s]&&e.push(s)}}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(r=function(){return a}.apply(t,[]))||(e.exports=r)}()}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.
 d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e={};r.r(e),r.d(e,{addFavorite:()=>Q,fetchCategories:()=>D,fetchPatternFlagReasons:()=>M,fetchPatterns:()=>A,loadCategories:()=>F,loadFavorites:()=>B,loadPattern:()=>I,loadPatternFlagReasons:()=>$,loadPatterns:()=>O,removeFavorite:()=>j,setCurrentQuery:()=>R,setErrorPatterns:()=>L});var t={};r.r(t),r.d(t,{getCategories:()=>z,getFavorites:()=>Y,getPattern:()=>W,getPatternFlagReasons:()=>H,getPatternsByQuery:()=>G});var n={};r.r(n),r.d(n,{getCategories:()=>ie,getCategoryById:()=>le,getCategoryBy
 Slug:()=>se,getCurrentQuery:()=>ne,getFavorites:()=>pe,getPattern:()=>re,getPatternFlagReasons:()=>ce,getPatternTotalPagesByQuery:()=>te,getPatternTotalsByQuery:()=>ee,getPatterns:()=>J,getPatternsByQuery:()=>Z,getQueryFromUrl:()=>ge,getUrlFromQuery:()=>me,hasLoadedCategories:()=>oe,isFavorite:()=>de,isLoadingCategories:()=>ae,isLoadingPatternFlagReasons:()=>ue,isLoadingPatternsByQuery:()=>X});const a=window.wp.element,o=window.wp.i18n,i=window.wp.htmlEntities,s=window.wp.data,l=e=>{let{name:t,url:r,avatar:n}=e;return(0,a.createElement)("a",{href:r,className:"pattern__author-avatar"},(0,a.createElement)("img",{alt:"",src:n}),t)},c=e=>{let{className:t="",style:r,children:n}=e;return(0,a.createElement)("span",{className:`${t} pattern-skeleton__container`,style:r},n)},u=e=>(0,a.createElement)("span",{className:"pattern-skeleton",style:e});function p()
 {return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},p.apply(this,arguments)}const d=window.wp.primitives;function g(e){return(0,a.createElement)(d.SVG,p({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),(0,a.createElement)(d.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"}))}const m=2/3;function f(e){return e*m}const h=()=>{const[e,t]=(0,a.useState)(),r=(0,a.useRef)();return(0,a.useEffect)((()=>{r.current&&t(`${f(r.current.clientWidth)}px`)}),[r]),(0,a.createElement)("div",{ref:r},(0,a.createElement)(c,null,(0,a.createElement)(u,{height:e}),(0,a.cre
 ateElement)(u,{height:"14px",marginTop:"1rem"}),(0,a.createElement)(c,{style:{flexDirection:"row",marginTop:"0.5rem",alignItems:"center"}},(0,a.createElement)(u,{height:"18px",width:"18px",marginRight:"0.5rem",borderRadius:"32px"}),(0,a.createElement)(u,{height:"12px",width:"100px",marginRight:"0.75rem"}),(0,a.createElement)(g,{width:"16px",height:"16px",fill:"#787c82",className:"pattern-favorite-button__filled"}),(0,a.createElement)(u,{height:"12px",width:"32px",marginLeft:"0.5rem"}))))},v=e=>{let{length:t=6}=e;return Array(t).fill().map(((e,t)=>(0,a.createElement)(h,{key:t})))},_=window.wp.url,y=e=>{const t={};return Object.keys(e).forEach((r=>{const n=e[r];null!=n&&n.toString().length>0&&(t[r]=n)})),t},w=e=>e.split("?")[0],E=(e,t)=>{if(!t||!e)retu
 rn"";const r=(0,_.getQueryArgs)(e);if(r[t])return r[t];const n=(o=w(e).replace(/\/$/,""),o.replace(/^\//,"")).split("/"),a=n.indexOf(t);var o;return-1===a?"":n[a+1]||""},b=e=>E(e,"categories"),P=e=>Number(E(e,"page")||1),S=e=>decodeURI(E(e,"search")),N=(0,a.createContext)();function k(e){let{children:t}=e;const[r,n]=(0,a.useState)((0,_.getPathAndQueryString)(window.location.href)),o=e=>{window.history.pushState("","",e),n(e)},i=()=>{n(document.location.href)};return(0,a.useEffect)((()=>(window.addEventListener("popstate",i),()=>{window.removeEventListener("popstate",i)})),[]),(0,a.createElement)(N.Provider,{value:{path:r,update:e=>{const t=(e=>{const t={...(0,_.getQueryArgs)(r),...(0,_.getQueryArgs)(e)};return y(t)})(e),n=w(e),a=(0,_.addQueryArgs)(n,t);o(a)},replace:o}},t)}function T(){const e=(0,a.useContext)(N);if(void 0===e)t
 hrow new Error("useRoute must be used within a Provider");return e}function x(e){let{currentPage:t=1,onNavigation:r,totalPages:n}=e;const{path:i,update:s}=T();if(!n||n<=1)return null;const l=t>1,c=t<n,u=(0,_.getQueryString)(i)?"?"+(0,_.getQueryString)(i):"",p=i.replace(u,"").replace(/page\/\d+\/?/,""),d=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const r=Array.from({length:e},((e,t)=>t+1)),n=[];return e<=5?r:(n.push(...r.slice(0,2)),t>=2&&t<=e-1&&n.push(...r.slice(t-2,t+1)),n.push(...r.slice(-2)),n.filter(((e,t,r)=>r.indexOf(e)===t)).reduce(((e,t,r,n)=>{if(0===r)return e.push(t),e;const a=Math.abs(n[r]-n[r-1]);return 0===a||(a>1&&e.push("…"),e.push(t)),e}),[]))}(n,t),g=`${p}page/%s/${u}`,m=e=>1===e?`${p}${u}`:(0,o.sprintf)(g,e),f=(e,t)=>{e.preventDefault(),s(m(t)),"function"==typeof r&&r()};return(0,a.cr
 eateElement)("nav",{className:"pagination","aria-label":(0,o.__)("Pagination","wporg-patterns")},(0,a.createElement)("ul",{className:"pagination__list"},(0,a.createElement)("li",{className:"pagination__item pagination__item-previous-page"},l&&(0,a.createElement)("a",{className:"pagination__link",href:m(t-1),onClick:e=>f(e,t-1)},(0,a.createElement)("span",{className:"screen-reader-text"},(0,o.__)("Previous page","wporg-patterns")),(0,a.createElement)("span",{"aria-hidden":!0},(0,o._x)("Previous","previous page link label","wporg-patterns")))),d.map(((e,r)=>"…"===e?(0,a.createElement)("li",{className:"pagination__item",key:`${r}-${e}`},e):(0,a.createElement)("li",{className:"pagination__item",key:e},(0,a.createElement)(&quo
 t;a",{className:"pagination__link",href:m(e),"aria-current":e===t?"page":void 0,onClick:t=>f(t,e)},(0,a.createElement)("span",{className:"screen-reader-text"},(0,o.sprintf)(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+(()=>{var e={472:(e,t)=>{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 i=a.apply(null,r);i&&e.push(i)}}else if("object"===o){if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]")){e.push(r.toString());continue}for(var s in r)n.call(r,s)&&r[s]&&e.push(s)}}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(r=function(){return a}.apply(t,[]))||(e.exports=r)}()}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d
 (t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e={};r.r(e),r.d(e,{addFavorite:()=>Q,fetchCategories:()=>D,fetchPatternFlagReasons:()=>M,fetchPatterns:()=>A,loadCategories:()=>F,loadFavorites:()=>B,loadPattern:()=>I,loadPatternFlagReasons:()=>$,loadPatterns:()=>O,removeFavorite:()=>j,setCurrentQuery:()=>R,setErrorPatterns:()=>L});var t={};r.r(t),r.d(t,{getCategories:()=>z,getFavorites:()=>Y,getPattern:()=>W,getPatternFlagReasons:()=>H,getPatternsByQuery:()=>G});var n={};r.r(n),r.d(n,{getCategories:()=>ie,getCategoryById:()=>le,getCategoryByS
 lug:()=>se,getCurrentQuery:()=>ne,getFavorites:()=>pe,getPattern:()=>re,getPatternFlagReasons:()=>ce,getPatternTotalPagesByQuery:()=>te,getPatternTotalsByQuery:()=>ee,getPatterns:()=>J,getPatternsByQuery:()=>Z,getQueryFromUrl:()=>ge,getUrlFromQuery:()=>me,hasLoadedCategories:()=>oe,isFavorite:()=>de,isLoadingCategories:()=>ae,isLoadingPatternFlagReasons:()=>ue,isLoadingPatternsByQuery:()=>X});const a=window.wp.element,o=window.wp.i18n,i=window.wp.htmlEntities,s=window.wp.data,l=e=>{let{name:t,url:r,avatar:n}=e;return(0,a.createElement)("a",{href:r,className:"pattern__author-avatar"},(0,a.createElement)("img",{alt:"",src:n}),t)},c=e=>{let{className:t="",style:r,children:n}=e;return(0,a.createElement)("span",{className:`${t} pattern-skeleton__container`,style:r},n)},u=e=>(0,a.createElement)("span",{className:"pattern-skeleton",style:e});function p(){
 return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},p.apply(this,arguments)}const d=window.wp.primitives;function g(e){return(0,a.createElement)(d.SVG,p({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),(0,a.createElement)(d.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"}))}const m=2/3;function f(e){return e*m}const h=()=>{const[e,t]=(0,a.useState)(),r=(0,a.useRef)();return(0,a.useEffect)((()=>{r.current&&t(`${f(r.current.clientWidth)}px`)}),[r]),(0,a.createElement)("div",{ref:r},(0,a.createElement)(c,null,(0,a.createElement)(u,{height:e}),(0,a.crea
 teElement)(u,{height:"14px",marginTop:"1rem"}),(0,a.createElement)(c,{style:{flexDirection:"row",marginTop:"0.5rem",alignItems:"center"}},(0,a.createElement)(u,{height:"18px",width:"18px",marginRight:"0.5rem",borderRadius:"32px"}),(0,a.createElement)(u,{height:"12px",width:"100px",marginRight:"0.75rem"}),(0,a.createElement)(g,{width:"16px",height:"16px",fill:"#787c82",className:"pattern-favorite-button__filled"}),(0,a.createElement)(u,{height:"12px",width:"32px",marginLeft:"0.5rem"}))))},v=e=>{let{length:t=6}=e;return Array(t).fill().map(((e,t)=>(0,a.createElement)(h,{key:t})))},_=window.wp.url,y=e=>{const t={};return Object.keys(e).forEach((r=>{const n=e[r];null!=n&&n.toString().length>0&&(t[r]=n)})),t},w=e=>e.split("?")[0],E=(e,t)=>{if(!t||!e)retur
 n"";const r=(0,_.getQueryArgs)(e);if(r[t])return r[t];const n=(o=w(e).replace(/\/$/,""),o.replace(/^\//,"")).split("/"),a=n.indexOf(t);var o;return-1===a?"":n[a+1]||""},b=e=>E(e,"categories"),S=e=>Number(E(e,"page")||1),P=e=>decodeURI(E(e,"search")),N=(0,a.createContext)();function k(e){let{children:t}=e;const[r,n]=(0,a.useState)((0,_.getPathAndQueryString)(window.location.href)),o=e=>{window.history.pushState("","",e),n(e)},i=()=>{n(document.location.href)};return(0,a.useEffect)((()=>(window.addEventListener("popstate",i),()=>{window.removeEventListener("popstate",i)})),[]),(0,a.createElement)(N.Provider,{value:{path:r,update:e=>{const t=(e=>{const t={...(0,_.getQueryArgs)(r),...(0,_.getQueryArgs)(e)};return y(t)})(e),n=w(e),a=(0,_.addQueryArgs)(n,t);o(a)},replace:o}},t)}function T(){const e=(0,a.useContext)(N);if(void 0===e)th
 row new Error("useRoute must be used within a Provider");return e}function x(e){let{currentPage:t=1,onNavigation:r,totalPages:n}=e;const{path:i,update:s}=T();if(!n||n<=1)return null;const l=t>1,c=t<n,u=(0,_.getQueryString)(i)?"?"+(0,_.getQueryString)(i):"",p=i.replace(u,"").replace(/page\/\d+\/?/,""),d=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const r=Array.from({length:e},((e,t)=>t+1)),n=[];return e<=5?r:(n.push(...r.slice(0,2)),t>=2&&t<=e-1&&n.push(...r.slice(t-2,t+1)),n.push(...r.slice(-2)),n.filter(((e,t,r)=>r.indexOf(e)===t)).reduce(((e,t,r,n)=>{if(0===r)return e.push(t),e;const a=Math.abs(n[r]-n[r-1]);return 0===a||(a>1&&e.push("…"),e.push(t)),e}),[]))}(n,t),g=`${p}page/%s/${u}`,m=e=>1===e?`${p}${u}`:(0,o.sprintf)(g,e),f=(e,t)=>{e.preventDefault(),s(m(t)),"function"==typeof r&&r()};return(0,a.cre
 ateElement)("nav",{className:"pagination","aria-label":(0,o.__)("Pagination","wporg-patterns")},(0,a.createElement)("ul",{className:"pagination__list"},(0,a.createElement)("li",{className:"pagination__item pagination__item-previous-page"},l&&(0,a.createElement)("a",{className:"pagination__link",href:m(t-1),onClick:e=>f(e,t-1)},(0,a.createElement)("span",{className:"screen-reader-text"},(0,o.__)("Previous page","wporg-patterns")),(0,a.createElement)("span",{"aria-hidden":!0},(0,o._x)("Previous","previous page link label","wporg-patterns")))),d.map(((e,r)=>"…"===e?(0,a.createElement)("li",{className:"pagination__item",key:`${r}-${e}`},e):(0,a.createElement)("li",{className:"pagination__item",key:e},(0,a.createElement)(&quot
 ;a",{className:"pagination__link",href:m(e),"aria-current":e===t?"page":void 0,onClick:t=>f(t,e)},(0,a.createElement)("span",{className:"screen-reader-text"},(0,o.sprintf)(
</ins><span class="cx" style="display: block; padding: 0 10px"> // translators: %s is the page number.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-(0,o.__)("Page %s","wporg-patterns"),e)),(0,a.createElement)("span",{"aria-hidden":!0},e))))),(0,a.createElement)("li",{className:"pagination__item pagination__item-next-page"},c&&(0,a.createElement)("a",{className:"pagination__link",href:m(t+1),onClick:e=>f(e,t+1)},(0,a.createElement)("span",{className:"screen-reader-text"},(0,o.__)("Next page","wporg-patterns")),(0,a.createElement)("span",{"aria-hidden":!0},(0,o._x)("Next","next page link label","wporg-patterns"))))))}const C=window.wp.dataControls;function A(e){return{type:"FETCH_BLOCK_PATTERNS",query:e}}function I(e,t){return{type:"LOAD_BLOCK_PATTERN",postId:e,pattern:t}}function O(e,t){let{page:r,patterns:n,total:a,totalPages:o}=t;retu
 rn{type:"LOAD_BLOCK_PATTERNS",query:e,page:r,patterns:n,total:a,totalPages:o}}function L(e,t){let{page:r,error:n}=t;return{type:"ERROR_BLOCK_PATTERNS",query:e,page:r,error:n}}function R(e){return{type:"SET_CURRENT_QUERY",query:e}}function D(){return{type:"FETCH_CATEGORIES"}}function F(e){return{type:"LOAD_CATEGORIES",categories:e}}function M(){return{type:"FETCH_PATTERN_FLAG_REASONS"}}function $(e){return{type:"LOAD_PATTERN_FLAG_REASONS",reasons:e}}function B(e){return{type:"LOAD_FAVORITES",patternIds:e}}function*Q(e){const t=yield(0,C.apiFetch)({path:"/wporg/v1/pattern-favorites",method:"POST",data:{id:e}});if("number"==typeof t)return{type:"ADD_FAVORITE",patternId:e,count:t}}function*j(e){const t=yield(0,C.apiFetch)({path:"/wporg/v1/pattern-favorites",method:"DELETE",data:{id:e}});if("number"==typeof t)return{type:"REMOVE_FAVORI
 TE",patternId:e,count:t}}function q(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=Object.keys(e).sort();let r="";for(let n=0;n<t.length;n++){const a=t[n];let o=e[a];switch(Array.isArray(o)&&(o=e[a].join()),a){case"page":case"per_page":case"_fields":break;default:r+=(r?"&":"")+(0,_.addQueryArgs)("",{[a]:o}).slice(1)}}return r}function U(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"LOAD_BLOCK_PATTERNS":{const r=(t.patterns||[]).reduce(((e,t)=>({...e,[t.id]:t})),{});return{...e,...r}}case"LOAD_BLOCK_PATTERN":return{...e,[t.postId]:t.pattern};case"ADD_FAVORITE":case"REMOVE_FAVORITE":{const r={...e[t.patternId],favorite_count:t.count};return{...e,[t.patternId]:r}}default:return e}}function K(){let e=arguments.length>0&amp
 ;&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const r=(t.patterns||[]).map((e=>{let{id:t}=e;return t})),{page:n,total:a,totalPages:o}=t;switch(t.type){case"LOAD_BLOCK_PATTERNS":{const i={...e[t.query]||{},total:a,totalPages:o};return i[n]=r,{...e,[t.query]:i}}case"ERROR_BLOCK_PATTERNS":{const r=e[t.query]||{};return r[n]=[],{...e,[t.query]:r}}default:return e}}const V=(0,s.combineReducers)({patterns:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{byId:U(e.byId,t),queries:K(e.queries,t)}},categories:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"FETCH_CATEGORIES":return null;case"LOAD_CATEGORIES":const e=(t.categories||[]).sort(((e,t)=>e.name.localeCompare(t.name)));return[{id:-1,slug:"",name:(0
 ,o.__)("All","wporg-patterns"),link:wporgPatternsUrl.site},...e]}return e},currentQuery:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1?arguments[1]:void 0;return"SET_CURRENT_QUERY"===t.type?t.query:e},patternFlagReasons:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"FETCH_PATTERN_FLAG_REASONS":return null;case"LOAD_PATTERN_FLAG_REASONS":return[...t.reasons];default:return e}},favorites:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;const{patternId:r}=t;switch(t.type){case"LOAD_FAVORITES":return t.patternIds;case"ADD_FAVORITE":return e.includes(r)?e:[...e,r];case"REMOVE_FAVORITE":return e.filter((e=>e!==r))}return e}});function*G(e){const t=q(e);tr
 y{yield A(t);const r=yield(0,C.apiFetch)({path:(0,_.addQueryArgs)("/wp/v2/wporg-pattern",{...e,locale:wporgLocale.id}),parse:!1}),{total:n,totalPages:a,results:o}=yield(0,C.__unstableAwaitPromise)(async function(e){try{return{total:Number(e.headers?.get("X-WP-Total")||0),totalPages:Number(e.headers?.get("X-WP-TotalPages")||0),results:await e.json()}}catch(e){return{}}}(r));yield O(t,{page:e.page||1,patterns:o,total:n,totalPages:a})}catch(r){const n=yield(0,C.__unstableAwaitPromise)(async function(e){try{return await e.json()}catch(e){return{}}}(r));yield L(t,{page:e.page||1,error:n})}}function*W(e){try{const t=yield(0,C.apiFetch)({path:(0,_.addQueryArgs)(`/wp/v2/wporg-pattern/${e}`)});yield I(e,t)}catch(e){}}function*z(){try{yield{type:"FETCH_CATEGORIES"};const e=yield(0,C.apiFetch)({path:(0,_.addQueryArgs)("/wp/v2/pattern-categories",{per_page:50})});yield F(e)}catch(e){}}function*H(){try{yield{type:"FETCH_PATTERN_FLAG_REASONS&
 quot;};const e=yield(0,C.apiFetch)({path:(0,_.addQueryArgs)("/wp/v2/wporg-pattern-flag-reason")});yield $(e)}catch(e){}}function*Y(){try{const e=yield(0,C.apiFetch)({path:"/wporg/v1/pattern-favorites"});yield B(e)}catch(e){}}function X(e,t){const r=q(t),n=t?.page||1;return!Array.isArray(e.patterns.queries?.[r]?.[n])}function J(e){return Object.values(e.patterns.byId)}function Z(e,t){const r=q(t),n=t?.page||1,a=e.patterns.queries?.[r]?.[n];return(a||[]).map((t=>e.patterns.byId[t]))}function ee(e,t){const r=q(t);return e.patterns.queries?.[r]?.total||0}function te(e,t){const r=q(t);return e.patterns.queries?.[r]?.totalPages||0}function re(e,t){return e.patterns.byId[t]||null}function ne(e){return e.currentQuery}function ae(e){return null===e.categories}function oe(e){return Array.isArray(e.categories)}function ie(e){return e.categories}function se(e,t){if(!oe(e))return;const[r]=e.categories.filter((e=>e.slug===t));return r}function le(e,t){if(oe(e))return e.c
 ategories.find((e=>{let{id:r}=e;return t===r}))}function ce(e){return e.patternFlagReasons}function ue(e){return null===e.patternFlagReasons}function pe(e){return e.favorites}function de(e,t){return e.favorites?.includes(t)}function ge(e,t){const r=["categories","author","page","search"],n=(0,_.getQueryArgs)(t),a=b(t);if(a&&-1===r.indexOf(a)){const t=se(e,a);t?.id&&(n["pattern-categories"]=t.id)}const o=E(t,"author");o&&-1===r.indexOf(o)&&(n.author_name=o);const i=P(t);"number"==typeof i&&i>1&&(n.page=i);const s=S(t);s.length>0&&-1===r.indexOf(s)&&(n.search=s);const l=E(t,"my-patterns");return l&&"page"!==l&&(n.status=l),n}function me(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:wporgPatternsUrl.site;if(r=r.
 replace(/\/$/,""),t.author_name&&(r+=`/author/${t.author_name}`,delete t.author_name),t["pattern-categories"]){const n=t["pattern-categories"],a=ie(e).find((e=>{let{id:t}=e;return n===t}));a?.slug&&(r+=`/categories/${a.slug}`),delete t["pattern-categories"]}return t.page&&(r+=`/page/${t.page}`,delete t.page),Object.keys(t).length?(r+="/?"+(0,_.buildQueryString)(t),r):r+"/"}const fe=(0,s.createReduxStore)("wporg/pattern-directory",{reducer:V,selectors:n,actions:e,controls:C.controls,resolvers:t});(0,s.register)(fe);const he=function(e){let{header:t,children:r,onNavigation:n,query:o,showPagination:i=!0}=e;const{isLoading:l,posts:c,totalPages:u}=(0,s.useSelect)((e=>{const{getPatternTotalPagesByQuery:t,getPatternsByQuery:r,isLoadingPatternsByQuery:n}=e(fe);return{isLoading:o&&n(o),posts:o?r(o):[],totalPages:o?t(o):0}}));return(0,a.createElement)(a.Fragment,null,c.length?t:null,(0,
 a.createElement)("div",{className:"pattern-grid"},l?(0,a.createElement)(v,{length:o?.per_page}):c.map(r)),i&&(0,a.createElement)(x,{totalPages:u,currentPage:o?.page,onNavigation:n}))},ve=window.wp.compose,_e=window.wp.components,ye=function(e){let{url:t}=e;return(0,a.createElement)("div",null,(0,a.createElement)("iframe",{className:"pattern-preview__viewport-iframe",title:(0,o.__)("Pattern Preview","wporg-patterns"),tabIndex:"-1",style:{width:"100%",height:"50vh",minHeight:"600px",overflowY:"auto"},src:t}))},we=window.React;var Ee=r.n(we);function be(e,t){return e.map((function(e,r){return e+t[r]}))}function Pe(e,t){return e.map((function(e,r){return e-t[r]}))}function Se(e){return Math.hypot.apply(Math,e)}function Ne(e){return Math.sign?Math.sign(e):Number(e>0)-Number(e<0)||+e}function ke(e,t,r){return 0===t||Math.abs(t)===1/0?function(e,t){return Ma
 th.pow(e,5*t)}(e,r):e*t*r/(t+r*e)}function Te(e,t,r,n){return void 0===n&&(n=.15),0===n?function(e,t,r){return Math.max(t,Math.min(e,r))}(e,t,r):e<t?-ke(t-e,r-t,n)+t:e>r?+ke(e-r,r-t,n)+r:e}function xe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ce(){return Ce=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ce.apply(this,arguments)}function Ae(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function Ie(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Oe(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Le(e,t){var r;if("u
 ndefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Oe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Oe(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}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(r=e[Symbol.iterator]()).next.bind(r)}function Re(){}function De(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return 0===t.length?Re:1===t.length?t[0]:function(){for(var e,r,n=Le(t);!(r=n()).done
 ;)e=r.value.apply(this,arguments)||e;return e}}function Fe(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 Me(e){if("function"==typeof e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e.apply(void 0,r)}return e}function $e(e,t){void 0===e&&(e={});for(var r={},n=0,a=Object.entries(t);n<a.length;n++){var o=a[n],i=o[0],s=o[1];switch(typeof s){case"function":r[i]=s.call(r,e[i],i,e);break;case"object":r[i]=$e(e[i],s);break;case"boolean":s&&(r[i]=e[i])}}return r}function Be(){return"undefined"!=typeof window&&"ontouchstart"in window}function Qe(e){return"pointerId"in e?null:"touchend"===e.type?e.changedTouches:e.targetTouches}function je(e){return Array.from(Qe(e)).map((function(e){return e.identifier}))}function qe(e){return
 {buttons:"buttons"in e?e.buttons:0,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey}}var Ue=function(e){return e};function Ke(e,t){void 0===t&&(t=Ue);var r=Qe(e),n=r?r[0]:e;return t([n.clientX,n.clientY])}var Ve=Ce({},{threshold:function(e){return void 0===e&&(e=0),Fe(e)},rubberband:function(e){switch(void 0===e&&(e=0),e){case!0:return Fe(.15);case!1:return Fe(0);default:return Fe(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:Fe(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 Ve.bounds(e(t))};var t=e,r=t.left,n=void 0===r?-1/0:r,a=t.right,o=void 0===a?1/0:a,i=t.top,s=void 0===i?-1/0:i,l=t.bottom;return[[n,o],[s,void 
 0===l?1/0:l]]}}),Ge="undefined"!=typeof window&&window.document&&window.document.createElement,We={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=Ge?window:void 0),e})),eventOptions:function(e){var t=void 0===e?{}:e,r=t.passive,n=void 0===r||r,a=t.capture;return{passive:n,capture:void 0!==a&&a}},transform:!0},ze=Ce({},Ve,{useTouch:function(e){void 0===e&&(e=!1);var t=Be(),r="undefined"!=typeof window&&"onpointerdown"in window;return!(!e||!t)||!(!t||r)},experimental_preventWindowScrollY:function(e){return void 0===e&&(e=!1),e},threshold:function(e,t,r){var n=r.filterTaps,a=void 0!==n&&n,o=r.lockDirection,i=void 0!==o&&o,s=r.axis,l=Fe(e,a?3:i||(void 0===s?void 0:s)?1:0);return this.filterTaps=a,l},swipeVelocity:
 function(e){return void 0===e&&(e=.5),Fe(e)},swipeDistance:function(e){return void 0===e&&(e=50),Fe(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 He(e){var t,r=e.domTarget,n=e.eventOptions,a=e.window,o=e.enabled,i=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,["domTarget","eventOptions","window","enabled"]),s=(void 0===(t={domTarget:r,eventOptions:n,window:a,enabled:o})&&(t={}),$e(t,We));return s.drag=function(e){return void 0===e&&(e={}),$e(e,ze)}(i),s}function Ye(e){return Ce({_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,_dragDel
 ayed:!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:Re,canceled:!1,memo:void 0,args:void 0},e)}function Xe(){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:Ye({_pointerId:void 0,axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0,tap:!1,swipe:[0,0]}),pinch:Ye({_pointerIds:[],da:[0,0],vdva:[0,0],origin:void 0,turns:0}),wheel:Ye({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),move:Ye({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),scroll:Ye({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0})}}var Je=new Map,Ze=function(e){return e},et=function(){function e(e,t){var r=this;void 0===t&&(t=[]),this.controller=e,this.args=t,this.debounced=!0,this.
 setTimeout=function(e,t){var n;void 0===t&&(t=140),clearTimeout(r.controller.timeouts[r.stateKey]);for(var a=arguments.length,o=new Array(a>2?a-2:0),i=2;i<a;i++)o[i-2]=arguments[i];r.controller.timeouts[r.stateKey]=(n=window).setTimeout.apply(n,[e,t].concat(o))},this.clearTimeout=function(){clearTimeout(r.controller.timeouts[r.stateKey])},this.fireGestureHandler=function(e){if(void 0===e&&(e=!1),r.state._blocked)return r.debounced||(r.state._active=!1,r.clean()),null;if(!e&&!r.state.intentional&&!r.config.triggerAllEvents)return null;if(r.state.intentional){var t=r.state.active,n=r.state._active;r.state.active=n,r.state.first=n&&!t,r.state.last=t&&!n,r.controller.state.shared[r.ingKey]=n}var a=r.controller.pointerIds.size||r.controller.touchIds.size,o=r.controller.state.shared.buttons>0||a>0,i=Ce({},r.controller.state.shared,r.state,r.mapStateValues(r.state),{locked:!!document.pointerLockElement,touches:a,down:o}),s=r.handl
 er(i);return r.state.memo=void 0!==s?s:r.state.memo,i},this.controller=e,this.args=t}var t,r,n=e.prototype;return n.updateSharedState=function(e){Object.assign(this.controller.state.shared,e)},n.updateGestureState=function(e){Object.assign(this.state,e)},n.checkIntentionality=function(e,t){return{_intentional:e,_blocked:!1}},n.getMovement=function(e){var t=this.config.rubberband,r=this.state,n=r._bounds,a=r._initial,o=r._active,i=r._intentional,s=r.lastOffset,l=r.movement,c=r._threshold,u=this.getInternalMovement(e,this.state),p=!1===i[0]?tt(u[0],c[0]):i[0],d=!1===i[1]?tt(u[1],c[1]):i[1],g=this.checkIntentionality([p,d],u);if(g._blocked)return Ce({},g,{_movement:u,delta:[0,0]});var m=g._intentional,f=u,h=[!1!==m[0]?u[0]-m[0]:0,!1!==m[1]?u[1]-m[1]:0],v=be(h,s),_=o?t:[0,0];return h=rt(n,be(h,a),_),Ce({},g,{intentional:!1!==m[0]||!1!==m[1],_initial:a,_movement:f,movement:h,values:e,offset:rt(n,v,_),delta:Pe(h,l)})},n.clean=function(){this.clearTimeout()},t=e,(r=[{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||Ze}}])&&xe(t.prototype,r),e}();function tt(e,t){return Math.abs(e)>=t&&Ne(e)*t}function rt(e,t,r){var n=t[0],a=t[1],o=r[0],i=r[1],s=e[0],l=s[0],c=s[1],u=e[1],p=u[0],d=u[1];return[Te(n,l,c,o),Te(a,p,d,i)]}function nt(e,t,r){var n=e.state,a=t.timeStamp,o=t.type,i=n.values;return{_lastEventType:o,event:t,timeStamp:a,elapsedTime:r?0:a-n.startTime,previous:i}}var at=function(e){var t=this;this.classes=e,this.pointerIds=new Set,this.touchIds=new Set,this.supportsTouchEvents=Be(),this.supportsGestureEvents=function(){try{return&
 quot;constructor"in GestureEvent}catch(e){return!1}}(),this.bind=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];for(var a,o={},i=Le(t.classes);!(a=i()).done;)new(0,a.value)(t,r).addBindings(o);var s=function(e){st(o,e,(function(n){return t.nativeRefs[e](Ce({},t.state.shared,{event:n,args:r}))}))};for(var l in t.nativeRefs)s(l);return t.config.domTarget?function(e,t){var r=e.config,n=e.domListeners,a=it(r);if(!a)throw new Error("domTarget must be defined");var o=r.eventOptions;ct(a,ot(n),o);for(var i=0,s=Object.entries(t);i<s.length;i++){var l=s[i],c=l[0],u=l[1],p=c.slice(2).toLowerCase();n.push([p,De.apply(void 0,u)])}lt(a,n,o)}(t,o):function(e,t){for(var r={},n=e.config.eventOptions.capture?"Capture":"",a=0,o=Object.entries(t);a<o.length;a++){var i=o[a],s=i[0],l=i[1],c=Array.isArray(l)?l:[l];r[s+n]=De.apply(void 0,c)}return r}(t,o)},this.effect=function(){return t.config.domTarget&&t.bind(),t.cl
 ean},this.clean=function(){var e=it(t.config),r=t.config.eventOptions;e&&ct(e,ot(t.domListeners),r),Object.values(t.timeouts).forEach(clearTimeout),function(e){var t=e.config,r=t.window,n=t.eventOptions,a=e.windowListeners;if(r){for(var o in a)ct(r,a[o],n);e.windowListeners={}}}(t)},this.classes=e,this.state=Xe(),this.timeouts={},this.domListeners=[],this.windowListeners={}};function ot(e){return void 0===e&&(e=[]),e.splice(0,e.length)}function it(e){var t=e.domTarget;return t&&"current"in t?t.current:t}function st(e,t,r){e[t]||(e[t]=[]),e[t].push(r)}function lt(e,t,r){void 0===t&&(t=[]),void 0===r&&(r={});for(var n,a=Le(t);!(n=a()).done;){var o=n.value,i=o[0],s=o[1];e.addEventListener(i,s,r)}}function ct(e,t,r){void 0===t&&(t=[]),void 0===r&&(r={});for(var n,a=Le(t);!(n=a()).done;){var o=n.value,i=o[0],s=o[1];e.removeEventListener(i,s,r)}}function ut(){}function pt(e){"persist"in e&&"function&q
 uot;==typeof e.persist&&e.persist()}var dt=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 r=e.target,n=e.pointerId;r&&"setPointerCapture"in r&&r.setPointerCapture(n),t.updateGestureState({_dragTarget:r,_dragPointerId:n})}},t.releasePointerCapture=function(){if(!t.config.useTouch&&!document.pointerLockElement){var e=t.state,r=e._dragTarget,n=e._dragPointerId;if(n&&r&&"releasePointerCapture"in r&&(!("hasPointerCapture"in r)||r.hasPointerCapture(n)))try{r.releasePointerCapture(n)}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.sta
 te._pointerId===t.getEventId(e)},t.shouldPreventWindowScrollY=t.config.experimental_preventWindowScrollY&&t.controller.supportsTouchEvents,t.setUpWindowScrollDetection=function(e){var r,n,a,o,i,s;pt(e),r=t.controller,n=t.stateKey,a=[["touchmove",t.preventScroll],["touchend",t.clean.bind(Ie(t))],["touchcancel",t.clean.bind(Ie(t))]],o={passive:!1},i=r.config,s=r.windowListeners,void 0===a&&(a=[]),void 0===o&&(o=i.eventOptions),i.window&&(ct(i.window,s[n],o),lt(i.window,s[n]=a,o)),t.setTimeout(t.startDrag.bind(Ie(t)),250,e)},t.setUpDelayedDragTrigger=function(e){t.state._dragDelayed=!0,pt(e),t.setTimeout(t.startDrag.bind(Ie(t)),t.config.delay,e)},t.setStartState=function(e){var r=Ke(e,t.transform);t.updateSharedState(qe(e)),t.updateGestureState(Ce({},function(e,t,r,n){var a=e.state,o=e.config,i=e.stateKey,s=e.args,l=e.transform,c=a.offset,u=r.timeStamp,p=o.initial,d=o.bounds,g=Pe(l(o.threshold),l([0,0])).map(Math.abs),m=Ce({
 },Xe()[i],{_active:!0,args:s,values:t,initial:null!=n?n:t,_threshold:g,offset:c,lastOffset:c,startTime:u});return Ce({},m,{_initial:Me(p,m),_bounds:Me(d,m)})}(Ie(t),r,e),nt(Ie(t),e,!0),{_pointerId:t.getEventId(e)})),t.updateGestureState(t.getMovement(r))},t.onDragStart=function(e){(function(e,t){"pointerId"in t?e.pointerIds.add(t.pointerId):e.touchIds=new Set(je(t))})(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 r;if(document.pointerLockElement){var n=e.movementX,a=e.movementY;r=be(t.transform([n,a]),t.state.values)}else r=Ke(e,t.transform);var o=t.getKinematics(r,e);if(!t.state._dragStarted){if(t.state._dragD
 elayed)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 i=qe(e);t.updateSharedState(i);var s=nt(Ie(t),e),l=Se(o._movement),c=t.state._dragIsTap;c&&l>=3&&(c=!1),t.updateGestureState(Ce({},s,o,{_dragIsTap:c})),t.fireGestureHandler()}},t.onDragEnd=function(e){if(function(e,t){"pointerId"in t?e.pointerIds.delete(t.pointerId):je(t).forEach((function(t){return e.touchIds.delete(t)}))}(t.controller,e),t.isValidEvent(e)&&(t.clean(),t.state._active)){t.state._active=!1;var r=t.state._dragIsTap,n=t.state.velocities,a=n[0],o=n[1],i=t.state.movement,s=i[0],l=i[1],c=t.state._intentional,u=c[0],p=c[1],d=t.config.swipeVelocity,g=d[0],m=d[1],f=t.config.swipeDistance,h=f[0],v=f[1],_=t.config.swipeDuration,y=Ce({},nt(Ie(t),e),t.getMovement(t.state.values)),w=[0,0];y.elapsedTime<_&&(!1!==u&&Math.abs(a)>g&
 amp;&Math.abs(s)>h&&(w[0]=Ne(a)),!1!==p&&Math.abs(o)>m&&Math.abs(l)>v&&(w[1]=Ne(o))),t.updateSharedState({buttons:0}),t.updateGestureState(Ce({},y,{tap:r,swipe:w})),t.fireGestureHandler(t.config.filterTaps&&!0===r)}},t.clean=function(){var r,n,a,o,i;e.prototype.clean.call(Ie(t)),t.state._dragStarted=!1,t.releasePointerCapture(),r=t.controller,n=t.stateKey,o=r.config,i=r.windowListeners,void 0===a&&(a=o.eventOptions),o.window&&(ct(o.window,i[n],a),delete i[n])},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}Ae(t,e);var r=t.prototype;return r.startDrag=function(e,t){void 0===t&&(t=!1),this.state._active&&!this.state._dragStarted&&(t||this.setStartState(e),this.updateGestureState({_dragStarted:!0,_d
 ragPreventScroll:!0,cancel:this.onCancel}),this.clearTimeout(),this.fireGestureHandler())},r.addBindings=function(e){this.config.useTouch?(st(e,"onTouchStart",this.onDragStart),st(e,"onTouchMove",this.onDragChange),st(e,"onTouchEnd",this.onDragEnd),st(e,"onTouchCancel",this.onDragEnd)):(st(e,"onPointerDown",this.onDragStart),st(e,"onPointerMove",this.onDragChange),st(e,"onPointerUp",this.onDragEnd),st(e,"onPointerCancel",this.onDragEnd)),this.config.filterTaps&&st(e,this.controller.config.eventOptions.capture?"onClick":"onClickCapture",this.onClick)},t}(function(e){function t(){return e.apply(this,arguments)||this}Ae(t,e);var r=t.prototype;return r.getInternalMovement=function(e,t){return Pe(e,t.initial)},r.checkIntentionality=function(e,t){if(!1===e[0]&&!1===e[1])return{_intentional:e,axis:this.state.axis};var r=t.map(Math.abs),n=r[0],a=r[1],o=this.state.axis||(n>a
 ?"x":n<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}},r.getKinematics=function(e,t){var r=this.getMovement(e);if(!r._blocked){var n=t.timeStamp-this.state.timeStamp;Object.assign(r,function(e,t,r){var n=Se(t),a=0===n?0:1/n,o=0===r?0:1/r,i=o*n,s=t.map((function(e){return o*e})),l=t.map((function(e){return a*e}));return{velocities:s,velocity:i,distance:Se(e),direction:l}}(r.movement,r.delta,n))}return r},r.mapStateValues=function(e){return{xy:e.values,vxvy:e.velocities}},t}(et));function gt(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var r,n,a,o;if(Array.isArray(e)){if((r=e.length)!==t.length)return!1;for(n
 =r;0!=n--;)if(!gt(e[n],t[n]))return!1;return!0}if("function"==typeof Map&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(n=o.next()).done;)if(!t.has(n.value[0]))return!1;for(o=e.entries();!(n=o.next()).done;)if(!gt(n.value[1],t.get(n.value[0])))return!1;return!0}if("function"==typeof Set&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(n=o.next()).done;)if(!t.has(n.value[0]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if((r=(a=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(n=r;0!=n--;)if(!Object.prototype.hasOwnProperty.call(t,a[n]))return!1;if("undefined"!=typeof Element&&e instanceof Element)return!1;for(n=r;0!=n--;)if(!(&quot
 ;_owner"===a[n]&&e.$$typeof||gt(e[a[n]],t[a[n]])))return!1;return!0}return e!=e&&t!=t}function mt(e,t){try{return gt(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}const ft=window.wp.keycodes,ht=function(e){let{label:t,className:r,onDragChange:n,onDragEnd:o,direction:i="left",...s}=e;const l=function(e,t){void 0===t&&(t={}),Je.set("drag",dt);var r=(0,we.useRef)();return r.current||(r.current=function(e,t){var r,n,a=[],o=!1;return function(){for(var i=arguments.length,s=new Array(i),l=0;l<i;l++)s[l]=arguments[l];return o&&r===this&&t(s,a)||(n=e.apply(this,s),o=!0,r=this,a=s),n}}(He,mt)),function(e,t,r){void 0===r&&(r={});var n=function(e){var t=new Set;return e.drag&&t.add(Je.get("drag")),e.wheel&&t.add(Je.get("wheel")),e.scroll&&t.add(Je.get("scrol
 l")),e.move&&t.add(Je.get("move")),e.pinch&&t.add(Je.get("pinch")),e.hover&&t.add(Je.get("hover")),t}(e),a=Ee().useMemo((function(){return new at(n)}),[]);return a.config=t,a.handlers=e,a.nativeRefs=r,Ee().useEffect(a.effect,[]),a.config.domTarget?ut:a.bind}({drag:e=>{let{delta:t,dragging:r}=e;const a="left"===i?-2:2;r?n(t[0]*a):o()}},r.current(t))}();return(0,a.createElement)("div",{className:`pattern-preview__drag-handle ${r}`},(0,a.createElement)("button",p({className:"pattern-preview__drag-handle-button","aria-label":t},s,{onKeyDown:e=>{const{keyCode:t}=e;"left"===i&&t===ft.LEFT||"right"===i&&t===ft.RIGHT?n(20):("left"===i&&t===ft.RIGHT||"right"===i&&t===ft.LEFT)&&n(-20)},onKeyUp:o},l())))},vt=function e(t){let{pattern:r}=t;const n=(0,ve.useViewportMatch)("mobile",">=&q
 uot;),i=(0,ve.useViewportMatch)("large",">="),s=(0,ve.useViewportMatch)("wide",">="),l=(0,ve.useInstanceId)(e),[c,u]=(0,a.useState)(window.innerWidth<960?window.innerWidth:960),p=(0,a.useCallback)((e=>u((t=>t+e))),[u]),d=()=>{c<280&&u(280)},g=(0,a.useMemo)((()=>n?s?[{label:(0,o.__)("Full (1200px)","wporg-patterns"),value:1200},{label:(0,o.__)("Default (960px)","wporg-patterns"),value:960},{label:(0,o.__)("Medium (480px)","wporg-patterns"),value:480},{label:(0,o.__)("Narrow (320px)","wporg-patterns"),value:320}]:i?[{label:(0,o.__)("Default (960px)","wporg-patterns"),value:960},{label:(0,o.__)("Medium (480px)","wporg-patterns"),value:480},{label:(0,o.__)("Narrow (320px)","wporg-patterns"),value:320}]:[{label:(0,o.__)("Medium (480px)","wporg-patterns"),value
 :480},{label:(0,o.__)("Narrow (320px)","wporg-patterns"),value:320}]:[]),[n,i,s]);let m=!1;if(!g.some((e=>e.value===c))){const e=Math.max(Math.floor(c),280);m={
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+(0,o.__)("Page %s","wporg-patterns"),e)),(0,a.createElement)("span",{"aria-hidden":!0},e))))),(0,a.createElement)("li",{className:"pagination__item pagination__item-next-page"},c&&(0,a.createElement)("a",{className:"pagination__link",href:m(t+1),onClick:e=>f(e,t+1)},(0,a.createElement)("span",{className:"screen-reader-text"},(0,o.__)("Next page","wporg-patterns")),(0,a.createElement)("span",{"aria-hidden":!0},(0,o._x)("Next","next page link label","wporg-patterns"))))))}const C=window.wp.dataControls;function A(e){return{type:"FETCH_BLOCK_PATTERNS",query:e}}function I(e,t){return{type:"LOAD_BLOCK_PATTERN",postId:e,pattern:t}}function O(e,t){let{page:r,patterns:n,total:a,totalPages:o}=t;retur
 n{type:"LOAD_BLOCK_PATTERNS",query:e,page:r,patterns:n,total:a,totalPages:o}}function L(e,t){let{page:r,error:n}=t;return{type:"ERROR_BLOCK_PATTERNS",query:e,page:r,error:n}}function R(e){return{type:"SET_CURRENT_QUERY",query:e}}function D(){return{type:"FETCH_CATEGORIES"}}function F(e){return{type:"LOAD_CATEGORIES",categories:e}}function M(){return{type:"FETCH_PATTERN_FLAG_REASONS"}}function $(e){return{type:"LOAD_PATTERN_FLAG_REASONS",reasons:e}}function B(e){return{type:"LOAD_FAVORITES",patternIds:e}}function*Q(e){const t=yield(0,C.apiFetch)({path:"/wporg/v1/pattern-favorites",method:"POST",data:{id:e}});if("number"==typeof t)return{type:"ADD_FAVORITE",patternId:e,count:t}}function*j(e){const t=yield(0,C.apiFetch)({path:"/wporg/v1/pattern-favorites",method:"DELETE",data:{id:e}});if("number"==typeof t)return{type:"REMOVE_FAVORIT
 E",patternId:e,count:t}}function q(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=Object.keys(e).sort();let r="";for(let n=0;n<t.length;n++){const a=t[n];let o=e[a];switch(Array.isArray(o)&&(o=e[a].join()),a){case"page":case"per_page":case"_fields":break;default:r+=(r?"&":"")+(0,_.addQueryArgs)("",{[a]:o}).slice(1)}}return r}function U(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"LOAD_BLOCK_PATTERNS":{const r=(t.patterns||[]).reduce(((e,t)=>({...e,[t.id]:t})),{});return{...e,...r}}case"LOAD_BLOCK_PATTERN":return{...e,[t.postId]:t.pattern};case"ADD_FAVORITE":case"REMOVE_FAVORITE":{const r={...e[t.patternId],favorite_count:t.count};return{...e,[t.patternId]:r}}default:return e}}function K(){let e=arguments.length>0&
 &void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;const r=(t.patterns||[]).map((e=>{let{id:t}=e;return t})),{page:n,total:a,totalPages:o}=t;switch(t.type){case"LOAD_BLOCK_PATTERNS":{const i={...e[t.query]||{},total:a,totalPages:o};return i[n]=r,{...e,[t.query]:i}}case"ERROR_BLOCK_PATTERNS":{const r=e[t.query]||{};return r[n]=[],{...e,[t.query]:r}}default:return e}}const V=(0,s.combineReducers)({patterns:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return{byId:U(e.byId,t),queries:K(e.queries,t)}},categories:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"FETCH_CATEGORIES":return null;case"LOAD_CATEGORIES":const e=(t.categories||[]).sort(((e,t)=>e.name.localeCompare(t.name)));return[{id:-1,slug:"",name:(0,
 o.__)("All","wporg-patterns"),link:wporgPatternsUrl.site},...e]}return e},currentQuery:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1?arguments[1]:void 0;return"SET_CURRENT_QUERY"===t.type?t.query:e},patternFlagReasons:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"FETCH_PATTERN_FLAG_REASONS":return null;case"LOAD_PATTERN_FLAG_REASONS":return[...t.reasons];default:return e}},favorites:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0;const{patternId:r}=t;switch(t.type){case"LOAD_FAVORITES":return t.patternIds;case"ADD_FAVORITE":return e.includes(r)?e:[...e,r];case"REMOVE_FAVORITE":return e.filter((e=>e!==r))}return e}});function*G(e){const t=q(e);try
 {yield A(t);const r=yield(0,C.apiFetch)({path:(0,_.addQueryArgs)("/wp/v2/wporg-pattern",{...e,locale:wporgLocale.id}),parse:!1}),{total:n,totalPages:a,results:o}=yield(0,C.__unstableAwaitPromise)(async function(e){try{return{total:Number(e.headers?.get("X-WP-Total")||0),totalPages:Number(e.headers?.get("X-WP-TotalPages")||0),results:await e.json()}}catch(e){return{}}}(r));yield O(t,{page:e.page||1,patterns:o,total:n,totalPages:a})}catch(r){const n=yield(0,C.__unstableAwaitPromise)(async function(e){try{return await e.json()}catch(e){return{}}}(r));yield L(t,{page:e.page||1,error:n})}}function*W(e){try{const t=yield(0,C.apiFetch)({path:(0,_.addQueryArgs)(`/wp/v2/wporg-pattern/${e}`)});yield I(e,t)}catch(e){}}function*z(){try{yield{type:"FETCH_CATEGORIES"};const e=yield(0,C.apiFetch)({path:(0,_.addQueryArgs)("/wp/v2/pattern-categories",{per_page:50})});yield F(e)}catch(e){}}function*H(){try{yield{type:"FETCH_PATTERN_FLAG_REASONS&q
 uot;};const e=yield(0,C.apiFetch)({path:(0,_.addQueryArgs)("/wp/v2/wporg-pattern-flag-reason")});yield $(e)}catch(e){}}function*Y(){try{const e=yield(0,C.apiFetch)({path:"/wporg/v1/pattern-favorites"});yield B(e)}catch(e){}}function X(e,t){const r=q(t),n=t?.page||1;return!Array.isArray(e.patterns.queries?.[r]?.[n])}function J(e){return Object.values(e.patterns.byId)}function Z(e,t){const r=q(t),n=t?.page||1,a=e.patterns.queries?.[r]?.[n];return(a||[]).map((t=>e.patterns.byId[t]))}function ee(e,t){const r=q(t);return e.patterns.queries?.[r]?.total||0}function te(e,t){const r=q(t);return e.patterns.queries?.[r]?.totalPages||0}function re(e,t){return e.patterns.byId[t]||null}function ne(e){return e.currentQuery}function ae(e){return null===e.categories}function oe(e){return Array.isArray(e.categories)}function ie(e){return e.categories}function se(e,t){if(!oe(e))return;const[r]=e.categories.filter((e=>e.slug===t));return r}function le(e,t){if(oe(e))return e.ca
 tegories.find((e=>{let{id:r}=e;return t===r}))}function ce(e){return e.patternFlagReasons}function ue(e){return null===e.patternFlagReasons}function pe(e){return e.favorites}function de(e,t){return e.favorites?.includes(t)}function ge(e,t){const r=["categories","author","page","search"],n=(0,_.getQueryArgs)(t),a=b(t);if(a&&-1===r.indexOf(a)){const t=se(e,a);t?.id&&(n["pattern-categories"]=t.id)}const o=E(t,"author");o&&-1===r.indexOf(o)&&(n.author_name=o);const i=S(t);"number"==typeof i&&i>1&&(n.page=i);const s=P(t);s.length>0&&-1===r.indexOf(s)&&(n.search=s);const l=E(t,"my-patterns");return l&&"page"!==l&&(n.status=l),n}function me(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:wporgPatternsUrl.site;if(r=r.r
 eplace(/\/$/,""),t.author_name&&(r+=`/author/${t.author_name}`,delete t.author_name),t["pattern-categories"]){const n=t["pattern-categories"],a=ie(e).find((e=>{let{id:t}=e;return n===t}));a?.slug&&(r+=`/categories/${a.slug}`),delete t["pattern-categories"]}return t.page&&(r+=`/page/${t.page}`,delete t.page),Object.keys(t).length?(r+="/?"+(0,_.buildQueryString)(t),r):r+"/"}const fe=(0,s.createReduxStore)("wporg/pattern-directory",{reducer:V,selectors:n,actions:e,controls:C.controls,resolvers:t});(0,s.register)(fe);const he=function(e){let{header:t,children:r,onNavigation:n,query:o,showPagination:i=!0}=e;const{isLoading:l,posts:c,totalPages:u}=(0,s.useSelect)((e=>{const{getPatternTotalPagesByQuery:t,getPatternsByQuery:r,isLoadingPatternsByQuery:n}=e(fe);return{isLoading:o&&n(o),posts:o?r(o):[],totalPages:o?t(o):0}}));return(0,a.createElement)(a.Fragment,null,c.length?t:null,(0,a
 .createElement)("div",{className:"pattern-grid"},l?(0,a.createElement)(v,{length:o?.per_page}):c.map(r)),i&&(0,a.createElement)(x,{totalPages:u,currentPage:o?.page,onNavigation:n}))},ve=window.wp.compose,_e=window.wp.components,ye=function(e){let{url:t}=e;return(0,a.createElement)("div",null,(0,a.createElement)("iframe",{className:"pattern-preview__viewport-iframe",title:(0,o.__)("Pattern Preview","wporg-patterns"),tabIndex:"-1",style:{width:"100%",height:"50vh",minHeight:"600px",overflowY:"auto"},src:t}))},we=window.React;var Ee=r.n(we);function be(e,t){return e.map((function(e,r){return e+t[r]}))}function Se(e,t){return e.map((function(e,r){return e-t[r]}))}function Pe(e){return Math.hypot.apply(Math,e)}function Ne(e){return Math.sign?Math.sign(e):Number(e>0)-Number(e<0)||+e}function ke(e,t,r){return 0===t||Math.abs(t)===1/0?function(e,t){return Mat
 h.pow(e,5*t)}(e,r):e*t*r/(t+r*e)}function Te(e,t,r,n){return void 0===n&&(n=.15),0===n?function(e,t,r){return Math.max(t,Math.min(e,r))}(e,t,r):e<t?-ke(t-e,r-t,n)+t:e>r?+ke(e-r,r-t,n)+r:e}function xe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ce(){return Ce=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ce.apply(this,arguments)}function Ae(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function Ie(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Oe(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Le(e,t){var r;if("un
 defined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Oe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Oe(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}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(r=e[Symbol.iterator]()).next.bind(r)}function Re(){}function De(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return 0===t.length?Re:1===t.length?t[0]:function(){for(var e,r,n=Le(t);!(r=n()).done;
 )e=r.value.apply(this,arguments)||e;return e}}function Fe(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 Me(e){if("function"==typeof e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e.apply(void 0,r)}return e}function $e(e,t){void 0===e&&(e={});for(var r={},n=0,a=Object.entries(t);n<a.length;n++){var o=a[n],i=o[0],s=o[1];switch(typeof s){case"function":r[i]=s.call(r,e[i],i,e);break;case"object":r[i]=$e(e[i],s);break;case"boolean":s&&(r[i]=e[i])}}return r}function Be(){return"undefined"!=typeof window&&"ontouchstart"in window}function Qe(e){return"pointerId"in e?null:"touchend"===e.type?e.changedTouches:e.targetTouches}function je(e){return Array.from(Qe(e)).map((function(e){return e.identifier}))}function qe(e){return{
 buttons:"buttons"in e?e.buttons:0,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey}}var Ue=function(e){return e};function Ke(e,t){void 0===t&&(t=Ue);var r=Qe(e),n=r?r[0]:e;return t([n.clientX,n.clientY])}var Ve=Ce({},{threshold:function(e){return void 0===e&&(e=0),Fe(e)},rubberband:function(e){switch(void 0===e&&(e=0),e){case!0:return Fe(.15);case!1:return Fe(0);default:return Fe(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:Fe(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 Ve.bounds(e(t))};var t=e,r=t.left,n=void 0===r?-1/0:r,a=t.right,o=void 0===a?1/0:a,i=t.top,s=void 0===i?-1/0:i,l=t.bottom;return[[n,o],[s,void 0
 ===l?1/0:l]]}}),Ge="undefined"!=typeof window&&window.document&&window.document.createElement,We={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=Ge?window:void 0),e})),eventOptions:function(e){var t=void 0===e?{}:e,r=t.passive,n=void 0===r||r,a=t.capture;return{passive:n,capture:void 0!==a&&a}},transform:!0},ze=Ce({},Ve,{useTouch:function(e){void 0===e&&(e=!1);var t=Be(),r="undefined"!=typeof window&&"onpointerdown"in window;return!(!e||!t)||!(!t||r)},experimental_preventWindowScrollY:function(e){return void 0===e&&(e=!1),e},threshold:function(e,t,r){var n=r.filterTaps,a=void 0!==n&&n,o=r.lockDirection,i=void 0!==o&&o,s=r.axis,l=Fe(e,a?3:i||(void 0===s?void 0:s)?1:0);return this.filterTaps=a,l},swipeVelocity:f
 unction(e){return void 0===e&&(e=.5),Fe(e)},swipeDistance:function(e){return void 0===e&&(e=50),Fe(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 He(e){var t,r=e.domTarget,n=e.eventOptions,a=e.window,o=e.enabled,i=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,["domTarget","eventOptions","window","enabled"]),s=(void 0===(t={domTarget:r,eventOptions:n,window:a,enabled:o})&&(t={}),$e(t,We));return s.drag=function(e){return void 0===e&&(e={}),$e(e,ze)}(i),s}function Ye(e){return Ce({_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,_dragDela
 yed:!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:Re,canceled:!1,memo:void 0,args:void 0},e)}function Xe(){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:Ye({_pointerId:void 0,axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0,tap:!1,swipe:[0,0]}),pinch:Ye({_pointerIds:[],da:[0,0],vdva:[0,0],origin:void 0,turns:0}),wheel:Ye({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),move:Ye({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),scroll:Ye({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0})}}var Je=new Map,Ze=function(e){return e},et=function(){function e(e,t){var r=this;void 0===t&&(t=[]),this.controller=e,this.args=t,this.debounced=!0,this.s
 etTimeout=function(e,t){var n;void 0===t&&(t=140),clearTimeout(r.controller.timeouts[r.stateKey]);for(var a=arguments.length,o=new Array(a>2?a-2:0),i=2;i<a;i++)o[i-2]=arguments[i];r.controller.timeouts[r.stateKey]=(n=window).setTimeout.apply(n,[e,t].concat(o))},this.clearTimeout=function(){clearTimeout(r.controller.timeouts[r.stateKey])},this.fireGestureHandler=function(e){if(void 0===e&&(e=!1),r.state._blocked)return r.debounced||(r.state._active=!1,r.clean()),null;if(!e&&!r.state.intentional&&!r.config.triggerAllEvents)return null;if(r.state.intentional){var t=r.state.active,n=r.state._active;r.state.active=n,r.state.first=n&&!t,r.state.last=t&&!n,r.controller.state.shared[r.ingKey]=n}var a=r.controller.pointerIds.size||r.controller.touchIds.size,o=r.controller.state.shared.buttons>0||a>0,i=Ce({},r.controller.state.shared,r.state,r.mapStateValues(r.state),{locked:!!document.pointerLockElement,touches:a,down:o}),s=r.handle
 r(i);return r.state.memo=void 0!==s?s:r.state.memo,i},this.controller=e,this.args=t}var t,r,n=e.prototype;return n.updateSharedState=function(e){Object.assign(this.controller.state.shared,e)},n.updateGestureState=function(e){Object.assign(this.state,e)},n.checkIntentionality=function(e,t){return{_intentional:e,_blocked:!1}},n.getMovement=function(e){var t=this.config.rubberband,r=this.state,n=r._bounds,a=r._initial,o=r._active,i=r._intentional,s=r.lastOffset,l=r.movement,c=r._threshold,u=this.getInternalMovement(e,this.state),p=!1===i[0]?tt(u[0],c[0]):i[0],d=!1===i[1]?tt(u[1],c[1]):i[1],g=this.checkIntentionality([p,d],u);if(g._blocked)return Ce({},g,{_movement:u,delta:[0,0]});var m=g._intentional,f=u,h=[!1!==m[0]?u[0]-m[0]:0,!1!==m[1]?u[1]-m[1]:0],v=be(h,s),_=o?t:[0,0];return h=rt(n,be(h,a),_),Ce({},g,{intentional:!1!==m[0]||!1!==m[1],_initial:a,_movement:f,movement:h,values:e,offset:rt(n,v,_),delta:Se(h,l)})},n.clean=function(){this.clearTimeout()},t=e,(r=[{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||Ze}}])&&xe(t.prototype,r),e}();function tt(e,t){return Math.abs(e)>=t&&Ne(e)*t}function rt(e,t,r){var n=t[0],a=t[1],o=r[0],i=r[1],s=e[0],l=s[0],c=s[1],u=e[1],p=u[0],d=u[1];return[Te(n,l,c,o),Te(a,p,d,i)]}function nt(e,t,r){var n=e.state,a=t.timeStamp,o=t.type,i=n.values;return{_lastEventType:o,event:t,timeStamp:a,elapsedTime:r?0:a-n.startTime,previous:i}}var at=function(e){var t=this;this.classes=e,this.pointerIds=new Set,this.touchIds=new Set,this.supportsTouchEvents=Be(),this.supportsGestureEvents=function(){try{return&q
 uot;constructor"in GestureEvent}catch(e){return!1}}(),this.bind=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];for(var a,o={},i=Le(t.classes);!(a=i()).done;)new(0,a.value)(t,r).addBindings(o);var s=function(e){st(o,e,(function(n){return t.nativeRefs[e](Ce({},t.state.shared,{event:n,args:r}))}))};for(var l in t.nativeRefs)s(l);return t.config.domTarget?function(e,t){var r=e.config,n=e.domListeners,a=it(r);if(!a)throw new Error("domTarget must be defined");var o=r.eventOptions;ct(a,ot(n),o);for(var i=0,s=Object.entries(t);i<s.length;i++){var l=s[i],c=l[0],u=l[1],p=c.slice(2).toLowerCase();n.push([p,De.apply(void 0,u)])}lt(a,n,o)}(t,o):function(e,t){for(var r={},n=e.config.eventOptions.capture?"Capture":"",a=0,o=Object.entries(t);a<o.length;a++){var i=o[a],s=i[0],l=i[1],c=Array.isArray(l)?l:[l];r[s+n]=De.apply(void 0,c)}return r}(t,o)},this.effect=function(){return t.config.domTarget&&t.bind(),t.cle
 an},this.clean=function(){var e=it(t.config),r=t.config.eventOptions;e&&ct(e,ot(t.domListeners),r),Object.values(t.timeouts).forEach(clearTimeout),function(e){var t=e.config,r=t.window,n=t.eventOptions,a=e.windowListeners;if(r){for(var o in a)ct(r,a[o],n);e.windowListeners={}}}(t)},this.classes=e,this.state=Xe(),this.timeouts={},this.domListeners=[],this.windowListeners={}};function ot(e){return void 0===e&&(e=[]),e.splice(0,e.length)}function it(e){var t=e.domTarget;return t&&"current"in t?t.current:t}function st(e,t,r){e[t]||(e[t]=[]),e[t].push(r)}function lt(e,t,r){void 0===t&&(t=[]),void 0===r&&(r={});for(var n,a=Le(t);!(n=a()).done;){var o=n.value,i=o[0],s=o[1];e.addEventListener(i,s,r)}}function ct(e,t,r){void 0===t&&(t=[]),void 0===r&&(r={});for(var n,a=Le(t);!(n=a()).done;){var o=n.value,i=o[0],s=o[1];e.removeEventListener(i,s,r)}}function ut(){}function pt(e){"persist"in e&&"function&qu
 ot;==typeof e.persist&&e.persist()}var dt=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 r=e.target,n=e.pointerId;r&&"setPointerCapture"in r&&r.setPointerCapture(n),t.updateGestureState({_dragTarget:r,_dragPointerId:n})}},t.releasePointerCapture=function(){if(!t.config.useTouch&&!document.pointerLockElement){var e=t.state,r=e._dragTarget,n=e._dragPointerId;if(n&&r&&"releasePointerCapture"in r&&(!("hasPointerCapture"in r)||r.hasPointerCapture(n)))try{r.releasePointerCapture(n)}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.stat
 e._pointerId===t.getEventId(e)},t.shouldPreventWindowScrollY=t.config.experimental_preventWindowScrollY&&t.controller.supportsTouchEvents,t.setUpWindowScrollDetection=function(e){var r,n,a,o,i,s;pt(e),r=t.controller,n=t.stateKey,a=[["touchmove",t.preventScroll],["touchend",t.clean.bind(Ie(t))],["touchcancel",t.clean.bind(Ie(t))]],o={passive:!1},i=r.config,s=r.windowListeners,void 0===a&&(a=[]),void 0===o&&(o=i.eventOptions),i.window&&(ct(i.window,s[n],o),lt(i.window,s[n]=a,o)),t.setTimeout(t.startDrag.bind(Ie(t)),250,e)},t.setUpDelayedDragTrigger=function(e){t.state._dragDelayed=!0,pt(e),t.setTimeout(t.startDrag.bind(Ie(t)),t.config.delay,e)},t.setStartState=function(e){var r=Ke(e,t.transform);t.updateSharedState(qe(e)),t.updateGestureState(Ce({},function(e,t,r,n){var a=e.state,o=e.config,i=e.stateKey,s=e.args,l=e.transform,c=a.offset,u=r.timeStamp,p=o.initial,d=o.bounds,g=Se(l(o.threshold),l([0,0])).map(Math.abs),m=Ce({}
 ,Xe()[i],{_active:!0,args:s,values:t,initial:null!=n?n:t,_threshold:g,offset:c,lastOffset:c,startTime:u});return Ce({},m,{_initial:Me(p,m),_bounds:Me(d,m)})}(Ie(t),r,e),nt(Ie(t),e,!0),{_pointerId:t.getEventId(e)})),t.updateGestureState(t.getMovement(r))},t.onDragStart=function(e){(function(e,t){"pointerId"in t?e.pointerIds.add(t.pointerId):e.touchIds=new Set(je(t))})(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 r;if(document.pointerLockElement){var n=e.movementX,a=e.movementY;r=be(t.transform([n,a]),t.state.values)}else r=Ke(e,t.transform);var o=t.getKinematics(r,e);if(!t.state._dragStarted){if(t.state._dragDe
 layed)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 i=qe(e);t.updateSharedState(i);var s=nt(Ie(t),e),l=Pe(o._movement),c=t.state._dragIsTap;c&&l>=3&&(c=!1),t.updateGestureState(Ce({},s,o,{_dragIsTap:c})),t.fireGestureHandler()}},t.onDragEnd=function(e){if(function(e,t){"pointerId"in t?e.pointerIds.delete(t.pointerId):je(t).forEach((function(t){return e.touchIds.delete(t)}))}(t.controller,e),t.isValidEvent(e)&&(t.clean(),t.state._active)){t.state._active=!1;var r=t.state._dragIsTap,n=t.state.velocities,a=n[0],o=n[1],i=t.state.movement,s=i[0],l=i[1],c=t.state._intentional,u=c[0],p=c[1],d=t.config.swipeVelocity,g=d[0],m=d[1],f=t.config.swipeDistance,h=f[0],v=f[1],_=t.config.swipeDuration,y=Ce({},nt(Ie(t),e),t.getMovement(t.state.values)),w=[0,0];y.elapsedTime<_&&(!1!==u&&Math.abs(a)>g&a
 mp;&Math.abs(s)>h&&(w[0]=Ne(a)),!1!==p&&Math.abs(o)>m&&Math.abs(l)>v&&(w[1]=Ne(o))),t.updateSharedState({buttons:0}),t.updateGestureState(Ce({},y,{tap:r,swipe:w})),t.fireGestureHandler(t.config.filterTaps&&!0===r)}},t.clean=function(){var r,n,a,o,i;e.prototype.clean.call(Ie(t)),t.state._dragStarted=!1,t.releasePointerCapture(),r=t.controller,n=t.stateKey,o=r.config,i=r.windowListeners,void 0===a&&(a=o.eventOptions),o.window&&(ct(o.window,i[n],a),delete i[n])},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}Ae(t,e);var r=t.prototype;return r.startDrag=function(e,t){void 0===t&&(t=!1),this.state._active&&!this.state._dragStarted&&(t||this.setStartState(e),this.updateGestureState({_dragStarted:!0,_dr
 agPreventScroll:!0,cancel:this.onCancel}),this.clearTimeout(),this.fireGestureHandler())},r.addBindings=function(e){this.config.useTouch?(st(e,"onTouchStart",this.onDragStart),st(e,"onTouchMove",this.onDragChange),st(e,"onTouchEnd",this.onDragEnd),st(e,"onTouchCancel",this.onDragEnd)):(st(e,"onPointerDown",this.onDragStart),st(e,"onPointerMove",this.onDragChange),st(e,"onPointerUp",this.onDragEnd),st(e,"onPointerCancel",this.onDragEnd)),this.config.filterTaps&&st(e,this.controller.config.eventOptions.capture?"onClick":"onClickCapture",this.onClick)},t}(function(e){function t(){return e.apply(this,arguments)||this}Ae(t,e);var r=t.prototype;return r.getInternalMovement=function(e,t){return Se(e,t.initial)},r.checkIntentionality=function(e,t){if(!1===e[0]&&!1===e[1])return{_intentional:e,axis:this.state.axis};var r=t.map(Math.abs),n=r[0],a=r[1],o=this.state.axis||(n>a?
 "x":n<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}},r.getKinematics=function(e,t){var r=this.getMovement(e);if(!r._blocked){var n=t.timeStamp-this.state.timeStamp;Object.assign(r,function(e,t,r){var n=Pe(t),a=0===n?0:1/n,o=0===r?0:1/r,i=o*n,s=t.map((function(e){return o*e})),l=t.map((function(e){return a*e}));return{velocities:s,velocity:i,distance:Pe(e),direction:l}}(r.movement,r.delta,n))}return r},r.mapStateValues=function(e){return{xy:e.values,vxvy:e.velocities}},t}(et));function gt(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var r,n,a,o;if(Array.isArray(e)){if((r=e.length)!==t.length)return!1;for(n=
 r;0!=n--;)if(!gt(e[n],t[n]))return!1;return!0}if("function"==typeof Map&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(n=o.next()).done;)if(!t.has(n.value[0]))return!1;for(o=e.entries();!(n=o.next()).done;)if(!gt(n.value[1],t.get(n.value[0])))return!1;return!0}if("function"==typeof Set&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(n=o.next()).done;)if(!t.has(n.value[0]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if((r=(a=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(n=r;0!=n--;)if(!Object.prototype.hasOwnProperty.call(t,a[n]))return!1;if("undefined"!=typeof Element&&e instanceof Element)return!1;for(n=r;0!=n--;)if(!("
 _owner"===a[n]&&e.$$typeof||gt(e[a[n]],t[a[n]])))return!1;return!0}return e!=e&&t!=t}function mt(e,t){try{return gt(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}const ft=window.wp.keycodes,ht=function(e){let{label:t,className:r,onDragChange:n,onDragEnd:o,direction:i="left",...s}=e;const l=function(e,t){void 0===t&&(t={}),Je.set("drag",dt);var r=(0,we.useRef)();return r.current||(r.current=function(e,t){var r,n,a=[],o=!1;return function(){for(var i=arguments.length,s=new Array(i),l=0;l<i;l++)s[l]=arguments[l];return o&&r===this&&t(s,a)||(n=e.apply(this,s),o=!0,r=this,a=s),n}}(He,mt)),function(e,t,r){void 0===r&&(r={});var n=function(e){var t=new Set;return e.drag&&t.add(Je.get("drag")),e.wheel&&t.add(Je.get("wheel")),e.scroll&&t.add(Je.get("scroll
 ")),e.move&&t.add(Je.get("move")),e.pinch&&t.add(Je.get("pinch")),e.hover&&t.add(Je.get("hover")),t}(e),a=Ee().useMemo((function(){return new at(n)}),[]);return a.config=t,a.handlers=e,a.nativeRefs=r,Ee().useEffect(a.effect,[]),a.config.domTarget?ut:a.bind}({drag:e=>{let{delta:t,dragging:r}=e;const a="left"===i?-2:2;r?n(t[0]*a):o()}},r.current(t))}();return(0,a.createElement)("div",{className:`pattern-preview__drag-handle ${r}`},(0,a.createElement)("button",p({className:"pattern-preview__drag-handle-button","aria-label":t},s,{onKeyDown:e=>{const{keyCode:t}=e;"left"===i&&t===ft.LEFT||"right"===i&&t===ft.RIGHT?n(20):("left"===i&&t===ft.RIGHT||"right"===i&&t===ft.LEFT)&&n(-20)},onKeyUp:o},l())))},vt=function e(t){let{pattern:r}=t;const n=(0,ve.useViewportMatch)("mobile",">=&qu
 ot;),i=(0,ve.useViewportMatch)("large",">="),s=(0,ve.useViewportMatch)("wide",">="),l=(0,ve.useInstanceId)(e),[c,u]=(0,a.useState)(window.innerWidth<960?window.innerWidth:960),p=(0,a.useCallback)((e=>u((t=>t+e))),[u]),d=()=>{c<280&&u(280)},g=(0,a.useMemo)((()=>n?s?[{label:(0,o.__)("Full (1200px)","wporg-patterns"),value:1200},{label:(0,o.__)("Default (960px)","wporg-patterns"),value:960},{label:(0,o.__)("Medium (480px)","wporg-patterns"),value:480},{label:(0,o.__)("Narrow (320px)","wporg-patterns"),value:320}]:i?[{label:(0,o.__)("Default (960px)","wporg-patterns"),value:960},{label:(0,o.__)("Medium (480px)","wporg-patterns"),value:480},{label:(0,o.__)("Narrow (320px)","wporg-patterns"),value:320}]:[{label:(0,o.__)("Medium (480px)","wporg-patterns"),value:
 480},{label:(0,o.__)("Narrow (320px)","wporg-patterns"),value:320}]:[]),[n,i,s]);let m=!1;if(!g.some((e=>e.value===c))){const e=Math.max(Math.floor(c),280);m={
</ins><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s is the width in pixels, ex 600. */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-label:(0,o.sprintf)((0,o.__)("Current (%spx)","wporg-patterns"),e),value:e}}return(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",{className:"pattern-preview__size-control"},n&&(0,a.createElement)(_e.SelectControl,{hideLabelFromVision:!0,label:(0,o.__)("Preview Width","wporg-patterns"),value:c,options:m?[m,...g]:g,onChange:e=>u(Number(e))})),(0,a.createElement)("div",{className:"pattern-preview__viewport",style:{width:c+40}},(0,a.createElement)(ht,{label:(0,o.__)("Drag to resize","wporg-patterns"),className:"is-left",onDragChange:p,onDragEnd:d,direction:"left","aria-describedby":`pattern-preview__resize-help-${l}`}),(0,a.createElement)(ye,{url:(0,_.addQueryArgs)(r.link,{view:!0})}),(0,a.createElement)(ht,{label:(0,o.__)("Drag to r
 esize","wporg-patterns"),className:"is-right",onDragChange:p,onDragEnd:d,direction:"right","aria-describedby":`pattern-preview__resize-help-${l}`}),(0,a.createElement)(_e.VisuallyHidden,{id:`pattern-preview__resize-help-${l}`,className:"pattern-preview__resize-help"},(0,o.__)("Use left and right arrow keys to resize the preview.","wporg-patterns"))))},_t=()=>(0,a.createElement)("div",{style:{height:"220px"}},(0,a.createElement)("img",{src:`${wporgPatternsUrl.assets}/images/copy-paste-demo.gif`,alt:(0,o.__)("GIF of copy and pasting.","wporg-patterns")})),yt=e=>{let{onFinish:t}=e;return(0,a.createElement)(_e.Animate,{type:"appear",options:{origin:"bottom"}},(e=>{let{className:r}=e;return(0,a.createElement)(_e.Guide,{className:`pattern-actions__guide ${r}`,onFinish:t,finishButtonText:(0,o.__)("Close","wporg-patterns&quo
 t;),pages:[{image:(0,a.createElement)(_t,null),content:(0,a.createElement)("div",{className:"pattern-actions__guide-content"},(0,a.createElement)("h3",{className:"pattern-actions__guide-title"},(0,o.__)("How to use patterns on your WordPress site.","wporg-patterns")),(0,a.createElement)("p",null,(0,o.__)("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")),(0,a.createElement)("ol",null,(0,a.createElement)("li",null,(0,a.createElement)("p",null,(0,o.__)("Open any post or page in the WordPress block editor.","wporg-patterns"))),(0,a.createElement)("li",null,(0,a.createElement)("p",null,(0,o.__)("Place your cursor where you want to add the pattern.","wporg-patterns"))),(0,a.createElement)("li",null,(0,a.c
 reateElement)("p",null,(0,a.createInterpolateElement)((0,o.__)("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:(0,a.createElement)("kbd",{className:"pattern-actions__guide-shortcut"})})))))}]})}))};var wt=r(472),Et=r.n(wt);const bt=window.lodash,Pt=window.wp.a11y,St=e=>{let{isSmall:t=!1,onSuccess:r=bt.noop,content:n}=e;const[i,s]=(0,a.useState)(!1);if(!n){const e=document.getElementById("block-data");n=JSON.parse(decodeURIComponent(e.value))}(0,a.useEffect)((()=>{if(!i)return;(0,Pt.speak)((0,o.__)("Copied pattern to clipboard.","wporg-patterns"));const e=setTimeout((()=>s(!1)),2e4);return()=>{clearTimeout(e)}}),[i]);let l=(0,o.__)("Copy Pattern","wporg-patter
 ns");t&&(l=i?(0,o.__)("Copied","wporg-patterns"):(0,o.__)("Copy","wporg-patterns"));const c=Et()({"pattern-copy-button":!0,"is-small-label":t});return(0,a.createElement)(_e.Button,{className:c,isPrimary:!0,onClick:e=>{let{target:t}=e;const a=(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 r=document.execCommand("copy");return document.body.removeChild(t),r})(n);s(a),t.focus(),a&&r()}},l)},Nt=e=>{let{onClick:t}=e;return(0,a.createElement)(_e.Notice,{className:"pattern-actions__notice",status:"success",isDismissible:!1,actions:[{label:(0,o.__)("Learn More","wporg-patterns"),onClick:t,variant:"secondary&
 quot;}]},(0,a.createElement)("div",null,(0,a.createElement)("strong",null,(0,o.__)("Pattern copied!","wporg-patterns")),(0,o.__)("Now you can paste it into any WordPress post or page.","wporg-patterns")))},kt=window.wp.coreData;function Tt(e){return(0,a.createElement)(d.SVG,p({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),(0,a.createElement)(d.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"}))}const xt=e=>{let{showLabel:t=!0,patternId:r}=e;const{hasPermission:n,isFavorite:i}=(0,s.useSelect)(
 (e=>(e(fe).getFavorites(),{hasPermission:!!e(kt.store).canUser("create","../../wporg/v1/pattern-favorites"),isFavorite:e(fe).isFavorite(r)}))),{addFavorite:l,removeFavorite:c}=(0,s.useDispatch)(fe),u=(0,a.useCallback)((()=>{i?c(r):l(r)}),[i]);if(!n)return null;const p=Et()("button button-link pattern-favorite-button",{"is-favorited":i,"has-label":t}),d=Et()({"screen-reader-text":!t});return(0,a.createElement)("button",{className:p,onClick:u},(0,a.createElement)(g,{className:"pattern-favorite-button__filled"}),(0,a.createElement)(Tt,{className:"pattern-favorite-button__outline"}),(0,a.createElement)("span",{className:d},i?(0,o.__)("Remove from favorites","wporg-patterns"):(0,o.__)("Add to favorites","wporg-patterns")))},Ct=window.wp.apiFetch;var At=r.n(Ct);const It=(0,a.createElement)(d.SVG,{viewBox:"0 0 24 24",xmlns:"http://
 www.w3.org/2000/svg"},(0,a.createElement)(d.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})),Ot=e=>{let{patternId:t,isSmall:r}=e;const{isDraft:n,parent:i}=(0,s.useSelect)((e=>{const r=e(fe).getPattern(t);return{isDraft:"draft"===r?.status,parent:r?.parent||0}}),[t]),{loadPattern:l}=(0,s.useDispatch)(fe),c=()=>{At()({path:`/wp/v2/wporg-pattern/${t}/`,method:"PUT",data:{status:"draft"}}).then((e=>{l(t,e)}))},u=()=>{window.confirm((0,o.__)("Are you sure you want to delete this pattern?","wporg-patterns"))&&At()({path:`/wp/v2/wporg-pattern/${t}/`,method:"DELETE"}).then((()=>{window.location=`${wporgPatternsUrl.site}/my-patterns/`}))},p=`${wporgPatternsUrl.site}/pattern/${i||t}/edit/`,d=r?(0,a.createElement)(_e.Icon,{icon:It}):(0,a.createElement)(a.Fragment,null,(0,o.__)("Options","wporg-patterns"),(0,a.createElement)(_e.Icon,{icon:It})),g=r?"patt
 ern-manage-options__button is-small":"pattern-manage-options__button";return(0,a.createElement)(_e.DropdownMenu,{className:"pattern-manage-options",icon:null,toggleProps:{className:g,children:d,variant:"secondary"},popoverProps:{position:"bottom center",className:"pattern-manage-options__popover"}},(()=>(0,a.createElement)(a.Fragment,null,(0,a.createElement)(_e.MenuItem,{href:p},i?(0,o.__)("Open original in editor","wporg-patterns"):(0,o.__)("Open in editor","wporg-patterns")),!n&&(0,a.createElement)(_e.MenuItem,{onClick:c},(0,o.__)("Revert to draft","wporg-patterns")),(0,a.createElement)(_e.MenuItem,{isDestructive:!0,variant:"link",onClick:u},(0,o.__)("Delete pattern","wporg-patterns")))))},Lt=e=>{let{postId:t,showOptions:r}=e;const[n,o]=(0,a.useState)(!1),[i,s]=(0,a.useState)(!1);return(0,a.createElement)("div",{cl
 assName:"pattern-actions"},(0,a.createElement)("div",{className:"pattern-actions__container"},(0,a.createElement)(St,{onSuccess:()=>o(!0)}),(0,a.createElement)(xt,{patternId:t}),r&&(0,a.createElement)(Ot,{patternId:t}),n&&(0,a.createElement)(Nt,{onClick:()=>s(!0)}),i&&(0,a.createElement)(yt,{onFinish:()=>s(!1)})))},Rt=e=>{let{element:t}=e;const[r,n]=(0,a.useState)(null);(0,a.useEffect)((()=>{if(!t.current)return;const e=(0,bt.debounce)(o,200);return o(),window.addEventListener("scroll",e),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e),window.removeEventListener("resize",e)}}),[t]);const o=()=>{if(!t.current)return;const e=window.innerHeight,{top:r}=t.current.getBoundingClientRect();n(r>=0&&r<=e)};return r},Dt=10,Ft=1e3,Mt=1200,$t=600;function Bt(e){let{alt:t,className:r,isReady:n=!1,src:i,style:s}=e;const l=(0,_.addQueryArg
 s)(`https://s0.wp.com/mshots/v1/${encodeURIComponent(i)}`,{w:$t,vpw:Mt,vph:f(Mt)}),[c,u]=(0,a.useState)(0),[p,d]=(0,a.useState)(!1),[g,m]=(0,a.useState)(!1),[h,v]=(0,a.useState)(""),y=c>Dt,w=n&&!p&&!y&&!g;return function(e,t){const r=(0,a.useRef)();(0,a.useEffect)((()=>{r.current=e}),[e]),(0,a.useEffect)((()=>{if(null!==t){const e=setInterval((function(){r.current()}),t);return()=>clearInterval(e)}}),[t])}((async()=>{try{const e=await fetch(l);200!==e.status||e.redirected?u(c+1):(await(async e=>{const t=await e.blob(),r=new FileReader;r.onload=e=>{v(e.target.result)},r.readAsDataURL(t)})(e),d(!0))}catch(e){m(!0)}}),w?Ft:null),n?w?(0,a.createElement)("div",{className:`${r} is-loading`,style:s},(0,a.createElement)(_e.Spinner,{style:{width:"32px",height:"32px"}}),(0,a.createElement)("span",{className:"screen-reader-text"},(0,o.__)("Loading","wporg-patterns"))):g|
 |y?(0,a.createElement)("div",{className:`${r} has-error`,style:s},(0,o.__)("Error","wporg-patterns")):(0,a.createElement)("div",{className:r},(0,a.createElement)("img",{src:h,alt:t,style:{...s,verticalAlign:"middle"}})):null}function Qt(e){let{alt:t,url:r,useMShot:n=!0}=e;const i=(0,a.useRef)(),s=Rt({element:i}),[l,c]=(0,a.useState)(1),[u,p]=(0,a.useState)(1),[d,g]=(0,a.useState)(!1);(0,a.useEffect)((()=>{s&&g(!0)}),[s]),(0,a.useEffect)((()=>{const e=()=>{try{c(f(i.current.clientWidth)),p(i.current.clientWidth)}catch(e){}};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[s]);const m={border:"none",width:"100%",maxWidth:"none",height:`${l}px`,display:"flex",alignItems:"center",justifyContent:"center"};return(0,a.createElement)("div",{ref:i},n?(0,a.createElement)(Bt,{class
 Name:"pattern-grid__preview",alt:t||(0,o.__)("Pattern Preview","wporg-patterns"),style:m,isReady:d,src:"local"===wporgPatternsData.env?r.replace(wporgPatternsUrl.site,"https://wordpress.org/patterns"):r}):(0,a.createElement)("div",{style:{height:`${l}px`,overflow:"hidden"}},(0,a.createElement)("iframe",{className:"pattern-grid__preview",title:t||(0,o.__)("Pattern Preview","wporg-patterns"),tabIndex:"-1",style:{border:"none",width:4*u+"px",maxWidth:"none",height:4*l+"px",transform:"scale(0.25)",transformOrigin:(0,o.isRTL)()?"top right":"top left",pointerEvents:"none"},src:d?r:""})))}const jt=e=>{let{className:t,label:r,patternId:n}=e;const{hasPermission:o,isFavorite:i}=(0,s.useSelect)((e=>(e(fe).getFavorites(),{hasPermission:!!e(kt.store).canUser("create","
 ../../wporg/v1/pattern-favorites"),isFavorite:e(fe).isFavorite(n)}))),{addFavorite:l,removeFavorite:c}=(0,s.useDispatch)(fe),u=(0,a.useCallback)((()=>{i?c(n):l(n)}),[i]),p=Et()(t,"pattern-favorite-button-small",{button:o,"button-link":o,"is-favorited":i});return o?(0,a.createElement)("button",{className:p,onClick:u},(0,a.createElement)(g,{className:"pattern-favorite-button__filled"}),(0,a.createElement)("span",null,r)):(0,a.createElement)("span",{className:p},(0,a.createElement)(g,{className:"pattern-favorite-button__filled"}),(0,a.createElement)("span",null,r))},qt=function(e){let{pattern:t,showAvatar:r,showOptions:n}=e;const s=function(e){switch(e.status){case"pending-review":case"pending":return(0,o.__)("Pending","wporg-patterns");case"draft":return(0,o.__)("Draft","wporg-patterns");case"unlisted":return(
 0,o.__)("Declined","wporg-patterns")}return""}(t);return(0,a.createElement)("div",{className:"pattern-grid__pattern"},(0,a.createElement)("div",{className:"pattern-grid__pattern-frame"},(0,a.createElement)("a",{href:t.link,rel:"bookmark"},(0,a.createElement)("span",{className:"screen-reader-text"},(0,i.decodeEntities)(t.title.rendered)),(0,a.createElement)(Qt,{useMShot:"publish"===t.status,url:(0,_.addQueryArgs)(t.link,{view:!0,modified:t.modified_gmt,version:wporgPatternsData.thumbnailVersion})})),s?(0,a.createElement)("div",{className:`pattern-grid__status is-${t.status}`},(0,a.createElement)("span",null,s)):null,(0,a.createElement)("span",{className:"pattern-grid__actions"},(0,a.createElement)(xt,{showLabel:!1,patternId:t.id}),n&&(0,a.createElement)(Ot,{isSmall:!0,patternId:t.id}),(0,a.createElement)(St,{isSmall:!0
 ,content:t.pattern_content}))),(0,a.createElement)("h2",{className:"pattern-grid__title"},(0,a.createElement)("a",{href:t.link},(0,i.decodeEntities)(t.title.rendered))),(0,a.createElement)("p",{className:"pattern-grid__meta"},r&&t.author_meta?(0,a.createElement)("a",{href:t.author_meta.url,className:"pattern-grid__author-avatar"},(0,a.createElement)("img",{alt:"",src:t.author_meta.avatar}),t.author_meta.name):null,t.favorite_count>0?(0,a.createElement)(jt,{className:"pattern-grid__favorite-count",patternId:t.id,label:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("span",{className:"screen-reader-text"},(0,o.sprintf)(/* translators: %s is the favorite count for a pattern. */
-(0,o._n)("Favorited %s times","Favorited %s times",t.favorite_count,"wporg-patterns"),t.favorite_count)),(0,a.createElement)("span",{"aria-hidden":!0},t.favorite_count))}):null))},Ut=function(e){let{icon:t,size:r=24,...n}=e;return(0,a.cloneElement)(t,{width:r,height:r,...n})},Kt=(0,a.createElement)(d.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(d.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),Vt=(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{}}},Gt=e=>{let{postId:t,onClose:r}=e;const[n,i]=(0,a.useReducer)(Vt,{}),[l,c]=(0,a.useState)(""),[u,p]=(0,a.useState)(""),d=(0,a.useRef)(),g=(0,o.__)("Your report has been submitted.","wporg-patterns"),{isLoading:m,mappe
 dReasons:f}=(0,s.useSelect)((e=>{const{getPatternFlagReasons:t,isLoadingPatternFlagReasons:r}=e(fe),n=t()||[];return{isLoading:r(),mappedReasons:n.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()})))}})),h=()=>{r(n.isSubmitted)};return(0,a.createElement)(_e.Modal,{className:"pattern-report-modal "+(n.isSubmitted?"":"pattern-report-modal__has-fixed-height"),title:(0,o.__)("Report this pattern","wporg-patterns"),onRequestClose:h},(0,a.createElement)("div",{ref:d},m?(0,a.createElement)(_e.Spinner,null):n.isSubmitted?(0,a.createElement)("p",{className:"pattern-report-modal__copy"},g):(0,a.createElement)("form",{onSubmit:e=>{e.preventDefault(),l&&u.length&&!n.isSubmitted&&!n.isSubmitting&&(i({status:"submitting"}),At()({path:(0,_.addQueryArg
 s)("/wp/v2/wporg-pattern-flag"),method:"POST",data:{parent:t,"wporg-pattern-flag-reason":l,excerpt:u}}).then((()=>{i({status:"submitted"}),(0,Pt.speak)(g),d.current.closest('[role="dialog"]').focus()})).catch((e=>{i({status:"error",message:e.message}),(0,Pt.speak)((0,o.sprintf)(/* translators: %s: Error message. */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+label:(0,o.sprintf)((0,o.__)("Current (%spx)","wporg-patterns"),e),value:e}}return(0,a.createElement)(a.Fragment,null,(0,a.createElement)("div",{className:"pattern-preview__size-control"},n&&(0,a.createElement)(_e.SelectControl,{hideLabelFromVision:!0,label:(0,o.__)("Preview Width","wporg-patterns"),value:c,options:m?[m,...g]:g,onChange:e=>u(Number(e))})),(0,a.createElement)("div",{className:"pattern-preview__viewport",style:{width:c+40}},(0,a.createElement)(ht,{label:(0,o.__)("Drag to resize","wporg-patterns"),className:"is-left",onDragChange:p,onDragEnd:d,direction:"left","aria-describedby":`pattern-preview__resize-help-${l}`}),(0,a.createElement)(ye,{url:(0,_.addQueryArgs)(r.link,{view:!0})}),(0,a.createElement)(ht,{label:(0,o.__)("Drag to re
 size","wporg-patterns"),className:"is-right",onDragChange:p,onDragEnd:d,direction:"right","aria-describedby":`pattern-preview__resize-help-${l}`}),(0,a.createElement)(_e.VisuallyHidden,{id:`pattern-preview__resize-help-${l}`,className:"pattern-preview__resize-help"},(0,o.__)("Use left and right arrow keys to resize the preview.","wporg-patterns"))))},_t=()=>(0,a.createElement)("div",{style:{height:"220px"}},(0,a.createElement)("img",{src:`${wporgPatternsUrl.assets}/images/copy-paste-demo.gif`,alt:(0,o.__)("GIF of copy and pasting.","wporg-patterns")})),yt=e=>{let{onFinish:t}=e;return(0,a.createElement)(_e.Animate,{type:"appear",options:{origin:"bottom"}},(e=>{let{className:r}=e;return(0,a.createElement)(_e.Guide,{className:`pattern-actions__guide ${r}`,onFinish:t,finishButtonText:(0,o.__)("Close","wporg-patterns&quot
 ;),pages:[{image:(0,a.createElement)(_t,null),content:(0,a.createElement)("div",{className:"pattern-actions__guide-content"},(0,a.createElement)("h3",{className:"pattern-actions__guide-title"},(0,o.__)("How to use patterns on your WordPress site.","wporg-patterns")),(0,a.createElement)("p",null,(0,o.__)("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")),(0,a.createElement)("ol",null,(0,a.createElement)("li",null,(0,a.createElement)("p",null,(0,o.__)("Open any post or page in the WordPress block editor.","wporg-patterns"))),(0,a.createElement)("li",null,(0,a.createElement)("p",null,(0,o.__)("Place your cursor where you want to add the pattern.","wporg-patterns"))),(0,a.createElement)("li",null,(0,a.cr
 eateElement)("p",null,(0,a.createInterpolateElement)((0,o.__)("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:(0,a.createElement)("kbd",{className:"pattern-actions__guide-shortcut"})})))))}]})}))};var wt=r(472),Et=r.n(wt);const bt=window.lodash,St=window.wp.a11y,Pt=e=>{let{isSmall:t=!1,onSuccess:r=bt.noop,content:n}=e;const[i,s]=(0,a.useState)(!1);if(!n){const e=document.getElementById("block-data");n=JSON.parse(decodeURIComponent(e.value))}(0,a.useEffect)((()=>{if(!i)return;(0,St.speak)((0,o.__)("Copied pattern to clipboard.","wporg-patterns"));const e=setTimeout((()=>s(!1)),2e4);return()=>{clearTimeout(e)}}),[i]);let l=(0,o.__)("Copy Pattern","wporg-pattern
 s");t&&(l=i?(0,o.__)("Copied","wporg-patterns"):(0,o.__)("Copy","wporg-patterns"));const c=Et()({"pattern-copy-button":!0,"is-small-label":t});return(0,a.createElement)(_e.Button,{className:c,isPrimary:!0,onClick:e=>{let{target:t}=e;const a=(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 r=document.execCommand("copy");return document.body.removeChild(t),r})(n);s(a),t.focus(),a&&r()}},l)},Nt=e=>{let{onClick:t}=e;return(0,a.createElement)(_e.Notice,{className:"pattern-actions__notice",status:"success",isDismissible:!1,actions:[{label:(0,o.__)("Learn More","wporg-patterns"),onClick:t,variant:"secondary&q
 uot;}]},(0,a.createElement)("div",null,(0,a.createElement)("strong",null,(0,o.__)("Pattern copied!","wporg-patterns")),(0,o.__)("Now you can paste it into any WordPress post or page.","wporg-patterns")))},kt=window.wp.coreData;function Tt(e){return(0,a.createElement)(d.SVG,p({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),(0,a.createElement)(d.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"}))}const xt=e=>{let{showLabel:t=!0,patternId:r}=e;const{hasPermission:n,isFavorite:i}=(0,s.useSelect)((
 e=>(e(fe).getFavorites(),{hasPermission:!!e(kt.store).canUser("create","../../wporg/v1/pattern-favorites"),isFavorite:e(fe).isFavorite(r)}))),{addFavorite:l,removeFavorite:c}=(0,s.useDispatch)(fe),u=(0,a.useCallback)((()=>{i?c(r):l(r)}),[i]);if(!n)return null;const p=Et()("button button-link pattern-favorite-button",{"is-favorited":i,"has-label":t}),d=Et()({"screen-reader-text":!t});return(0,a.createElement)("button",{className:p,onClick:u},(0,a.createElement)(g,{className:"pattern-favorite-button__filled"}),(0,a.createElement)(Tt,{className:"pattern-favorite-button__outline"}),(0,a.createElement)("span",{className:d},i?(0,o.__)("Remove from favorites","wporg-patterns"):(0,o.__)("Add to favorites","wporg-patterns")))},Ct=window.wp.apiFetch;var At=r.n(Ct);const It=(0,a.createElement)(d.SVG,{viewBox:"0 0 24 24",xmlns:"http://w
 ww.w3.org/2000/svg"},(0,a.createElement)(d.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})),Ot=e=>{let{patternId:t,isSmall:r}=e;const{isDraft:n,parent:i}=(0,s.useSelect)((e=>{const r=e(fe).getPattern(t);return{isDraft:"draft"===r?.status,parent:r?.parent||0}}),[t]),{loadPattern:l}=(0,s.useDispatch)(fe),c=()=>{At()({path:`/wp/v2/wporg-pattern/${t}/`,method:"PUT",data:{status:"draft"}}).then((e=>{l(t,e)}))},u=()=>{window.confirm((0,o.__)("Are you sure you want to delete this pattern?","wporg-patterns"))&&At()({path:`/wp/v2/wporg-pattern/${t}/`,method:"DELETE"}).then((()=>{window.location=`${wporgPatternsUrl.site}/my-patterns/`}))},p=`${wporgPatternsUrl.site}/pattern/${i||t}/edit/`,d=r?(0,a.createElement)(_e.Icon,{icon:It}):(0,a.createElement)(a.Fragment,null,(0,o.__)("Options","wporg-patterns"),(0,a.createElement)(_e.Icon,{icon:It})),g=r?"patte
 rn-manage-options__button is-small":"pattern-manage-options__button";return(0,a.createElement)(_e.DropdownMenu,{className:"pattern-manage-options",icon:null,toggleProps:{className:g,children:d,variant:"secondary"},popoverProps:{position:"bottom center",className:"pattern-manage-options__popover"}},(()=>(0,a.createElement)(a.Fragment,null,(0,a.createElement)(_e.MenuItem,{href:p},i?(0,o.__)("Open original in editor","wporg-patterns"):(0,o.__)("Open in editor","wporg-patterns")),!n&&(0,a.createElement)(_e.MenuItem,{onClick:c},(0,o.__)("Revert to draft","wporg-patterns")),(0,a.createElement)(_e.MenuItem,{isDestructive:!0,variant:"link",onClick:u},(0,o.__)("Delete pattern","wporg-patterns")))))},Lt=e=>{let{postId:t,showOptions:r}=e;const[n,o]=(0,a.useState)(!1),[i,s]=(0,a.useState)(!1);return(0,a.createElement)("div",{cla
 ssName:"pattern-actions"},(0,a.createElement)("div",{className:"pattern-actions__container"},(0,a.createElement)(Pt,{onSuccess:()=>o(!0)}),(0,a.createElement)(xt,{patternId:t}),r&&(0,a.createElement)(Ot,{patternId:t}),n&&(0,a.createElement)(Nt,{onClick:()=>s(!0)}),i&&(0,a.createElement)(yt,{onFinish:()=>s(!1)})))},Rt=e=>{let{element:t}=e;const[r,n]=(0,a.useState)(null);(0,a.useEffect)((()=>{if(!t.current)return;const e=(0,bt.debounce)(o,200);return o(),window.addEventListener("scroll",e),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e),window.removeEventListener("resize",e)}}),[t]);const o=()=>{if(!t.current)return;const e=window.innerHeight,{top:r}=t.current.getBoundingClientRect();n(r>=0&&r<=e)};return r},Dt=10,Ft=2e3,Mt=1200,$t=600;function Bt(e){let{alt:t,className:r,isReady:n=!1,src:i,style:s}=e;const l=(0,_.addQueryArgs
 )(`https://s0.wp.com/mshots/v1/${encodeURIComponent(i)}`,{w:$t,vpw:Mt,vph:f(Mt)}),[c,u]=(0,a.useState)(0),[p,d]=(0,a.useState)(!1),[g,m]=(0,a.useState)(!1),[h,v]=(0,a.useState)(""),[y,w]=(0,a.useState)(!1),E=c>Dt,b=n&&!p&&!E&&!g,S=async()=>{try{const e=await fetch(l);e.redirected?w(!0):200!==e.status||e.redirected?u(c+1):(await(async e=>{const t=await e.blob(),r=new FileReader;r.onload=e=>{v(e.target.result)},r.readAsDataURL(t)})(e),d(!0),w(!1))}catch(e){m(!0),w(!1)}};return(0,a.useEffect)((()=>{(async()=>{await S()})()}),[]),function(e,t){const r=(0,a.useRef)();(0,a.useEffect)((()=>{r.current=e}),[e]),(0,a.useEffect)((()=>{if(null!==t){const e=setInterval((function(){r.current()}),t);return()=>clearInterval(e)}}),[t])}((async()=>{await S()}),y?Ft:null),n?b?(0,a.createElement)("div",{className:`${r} is-loading`,style:s},(0,a.createElement)(_e.Spinner,{style:{width:"32px",height:"32px"}}),(0
 ,a.createElement)("span",{className:"screen-reader-text"},(0,o.__)("Loading","wporg-patterns"))):g||E?(0,a.createElement)("div",{className:`${r} has-error`,style:s},(0,o.__)("Error","wporg-patterns")):(0,a.createElement)("div",{className:r},(0,a.createElement)("img",{src:h,alt:t,style:{...s,verticalAlign:"middle"}})):null}function Qt(e){let{alt:t,url:r,useMShot:n=!0}=e;const i=(0,a.useRef)(),s=Rt({element:i}),[l,c]=(0,a.useState)(1),[u,p]=(0,a.useState)(1),[d,g]=(0,a.useState)(!1);(0,a.useEffect)((()=>{s&&g(!0)}),[s]),(0,a.useEffect)((()=>{const e=()=>{try{c(f(i.current.clientWidth)),p(i.current.clientWidth)}catch(e){}};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[s]);const m={border:"none",width:"100%",maxWidth:"none",height:`${l}px`,display:"flex",alignIt
 ems:"center",justifyContent:"center"};return(0,a.createElement)("div",{ref:i},n?(0,a.createElement)(Bt,{className:"pattern-grid__preview",alt:t||(0,o.__)("Pattern Preview","wporg-patterns"),style:m,isReady:d,src:"local"===wporgPatternsData.env?r.replace(wporgPatternsUrl.site,"https://wordpress.org/patterns"):r}):(0,a.createElement)("div",{style:{height:`${l}px`,overflow:"hidden"}},(0,a.createElement)("iframe",{className:"pattern-grid__preview",title:t||(0,o.__)("Pattern Preview","wporg-patterns"),tabIndex:"-1",style:{border:"none",width:4*u+"px",maxWidth:"none",height:4*l+"px",transform:"scale(0.25)",transformOrigin:(0,o.isRTL)()?"top right":"top left",pointerEvents:"none"},src:d?r:""})))}const jt=e=>{let{className:t,label:r,patternId:n}=e;cons
 t{hasPermission:o,isFavorite:i}=(0,s.useSelect)((e=>(e(fe).getFavorites(),{hasPermission:!!e(kt.store).canUser("create","../../wporg/v1/pattern-favorites"),isFavorite:e(fe).isFavorite(n)}))),{addFavorite:l,removeFavorite:c}=(0,s.useDispatch)(fe),u=(0,a.useCallback)((()=>{i?c(n):l(n)}),[i]),p=Et()(t,"pattern-favorite-button-small",{button:o,"button-link":o,"is-favorited":i});return o?(0,a.createElement)("button",{className:p,onClick:u},(0,a.createElement)(g,{className:"pattern-favorite-button__filled"}),(0,a.createElement)("span",null,r)):(0,a.createElement)("span",{className:p},(0,a.createElement)(g,{className:"pattern-favorite-button__filled"}),(0,a.createElement)("span",null,r))},qt=function(e){let{pattern:t,showAvatar:r,showOptions:n}=e;const s=function(e){switch(e.status){case"pending-review":case"pending":return(0,o.__)("Pending",&quo
 t;wporg-patterns");case"draft":return(0,o.__)("Draft","wporg-patterns");case"unlisted":return(0,o.__)("Declined","wporg-patterns")}return""}(t);return(0,a.createElement)("div",{className:"pattern-grid__pattern"},(0,a.createElement)("div",{className:"pattern-grid__pattern-frame"},(0,a.createElement)("a",{href:t.link,rel:"bookmark"},(0,a.createElement)("span",{className:"screen-reader-text"},(0,i.decodeEntities)(t.title.rendered)),(0,a.createElement)(Qt,{useMShot:"publish"===t.status,url:(0,_.addQueryArgs)(t.link,{view:!0,modified:t.modified_gmt,version:wporgPatternsData.thumbnailVersion})})),s?(0,a.createElement)("div",{className:`pattern-grid__status is-${t.status}`},(0,a.createElement)("span",null,s)):null,(0,a.createElement)("span",{className:"pattern-grid__actions"},(0,a.createE
 lement)(xt,{showLabel:!1,patternId:t.id}),n&&(0,a.createElement)(Ot,{isSmall:!0,patternId:t.id}),(0,a.createElement)(Pt,{isSmall:!0,content:t.pattern_content}))),(0,a.createElement)("h2",{className:"pattern-grid__title"},(0,a.createElement)("a",{href:t.link},(0,i.decodeEntities)(t.title.rendered))),(0,a.createElement)("p",{className:"pattern-grid__meta"},r&&t.author_meta?(0,a.createElement)("a",{href:t.author_meta.url,className:"pattern-grid__author-avatar"},(0,a.createElement)("img",{alt:"",src:t.author_meta.avatar}),t.author_meta.name):null,t.favorite_count>0?(0,a.createElement)(jt,{className:"pattern-grid__favorite-count",patternId:t.id,label:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("span",{className:"screen-reader-text"},(0,o.sprintf)(/* translators: %s is the favorite count for a pattern. */
+(0,o._n)("Favorited %s times","Favorited %s times",t.favorite_count,"wporg-patterns"),t.favorite_count)),(0,a.createElement)("span",{"aria-hidden":!0},t.favorite_count))}):null))},Ut=function(e){let{icon:t,size:r=24,...n}=e;return(0,a.cloneElement)(t,{width:r,height:r,...n})},Kt=(0,a.createElement)(d.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(d.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),Vt=(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{}}},Gt=e=>{let{postId:t,onClose:r}=e;const[n,i]=(0,a.useReducer)(Vt,{}),[l,c]=(0,a.useState)(""),[u,p]=(0,a.useState)(""),d=(0,a.useRef)(),g=(0,o.__)("Your report has been submitted.","wporg-patterns"),{isLoading:m,mappe
 dReasons:f}=(0,s.useSelect)((e=>{const{getPatternFlagReasons:t,isLoadingPatternFlagReasons:r}=e(fe),n=t()||[];return{isLoading:r(),mappedReasons:n.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()})))}})),h=()=>{r(n.isSubmitted)};return(0,a.createElement)(_e.Modal,{className:"pattern-report-modal "+(n.isSubmitted?"":"pattern-report-modal__has-fixed-height"),title:(0,o.__)("Report this pattern","wporg-patterns"),onRequestClose:h},(0,a.createElement)("div",{ref:d},m?(0,a.createElement)(_e.Spinner,null):n.isSubmitted?(0,a.createElement)("p",{className:"pattern-report-modal__copy"},g):(0,a.createElement)("form",{onSubmit:e=>{e.preventDefault(),l&&u.length&&!n.isSubmitted&&!n.isSubmitting&&(i({status:"submitting"}),At()({path:(0,_.addQueryArg
 s)("/wp/v2/wporg-pattern-flag"),method:"POST",data:{parent:t,"wporg-pattern-flag-reason":l,excerpt:u}}).then((()=>{i({status:"submitted"}),(0,St.speak)(g),d.current.closest('[role="dialog"]').focus()})).catch((e=>{i({status:"error",message:e.message}),(0,St.speak)((0,o.sprintf)(/* translators: %s: Error message. */
</ins><span class="cx" style="display: block; padding: 0 10px"> (0,o.__)("Error: %s","wporg-patterns"),e.message))})))}},(0,a.createElement)(_e.RadioControl,{className:"pattern-report-modal__radio",label:(0,o.__)("Please choose a reason:","wporg-patterns"),selected:l,options:f,onChange:c,required:!0}),(0,a.createElement)(_e.TextareaControl,{label:(0,o.__)("Please provide details (required)","wporg-patterns"),value:u,onChange:p,required:!0}),n.hasError&&(0,a.createElement)("div",{className:"notice notice-large notice-alt notice-error"},n.message),(0,a.createElement)("div",{className:"pattern-report-modal__actions"},(0,a.createElement)(_e.Button,{isSecondary:!0,onClick:h},(0,o.__)("Cancel","wporg-patterns")),(0,a.createElement)(_e.Button,{type:"submit",isBusy:n.isSubmitting,isPrimary:!0},n.isSubmitting?(0,o.__)("Submitting …",&q
 uot;wporg-patterns"):(0,o.__)("Report","wporg-patterns"))))))},Wt=e=>{let{postId:t,userHasReported:r}=e;const[n,i]=(0,a.useState)(!1),[s,l]=(0,a.useState)(!1),c=r||s,u=!!wporgPatternsData.userId;return c?(0,a.createElement)("p",{className:"pattern-report-button__copy"},(0,a.createElement)(Ut,{icon:Kt}),(0,o.__)("You've reported this pattern","wporg-patterns")):u?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(_e.Button,{className:"pattern-report-button",isLink:!0,onClick:()=>i(!0)},(0,o.__)("Report this pattern","wporg-patterns")),n&&(0,a.createElement)(Gt,{postId:t,onClose:e=>{i(!1),l(e)}})):(0,a.createElement)("p",{className:"pattern-report-button__copy"},(0,a.createElement)("a",{href:(0,_.addQueryArgs)("/wp-login.php",{redirect_to:window.location.pathname})},(0,o.__)("Login to report this pattern","wporg-pat
 terns")))};function zt(e){let{pattern:t}=e;const[r,n]=(0,a.useState)(!1),i=()=>n(!0),s=()=>n(!1);switch(t.status){case"pending-review":case"pending":return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(_e.Notice,{className:"pattern__status-notice",status:"warning",isDismissible:!1,actions:[{label:(0,o.__)("Learn More","wporg-patterns"),onClick:i,variant:"secondary"}]},(0,a.createElement)("p",null,(0,a.createElement)("strong",null,(0,o.__)("Review pending.","wporg-patterns")),(0,o.__)("This pattern is only visible to you. Once approved it will be published to everyone.","wporg-patterns"))),r&&(0,a.createElement)(_e.Modal,{title:(0,o.__)("Review Pending","wporg-patterns"),onRequestClose:s,className:"pattern__status-notice-modal"},(0,a.createElement)("p",null,(0,o.__)("All patterns subm
 itted to WordPress.org are subject to both automated and manual approval. It might take a few days for your pattern to be approved.","wporg-patterns")),(0,a.createElement)("p",null,(0,o.__)("Reviewers look for content that may be problematic (copyright or trademark issues) and whether your pattern works as intended.","wporg-patterns"))));case"draft":return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(_e.Notice,{className:"pattern__status-notice",status:"info",isDismissible:!1,actions:[{label:(0,o.__)("Learn More","wporg-patterns"),onClick:i,variant:"secondary"}]},(0,a.createElement)("p",null,(0,a.createElement)("strong",null,(0,o.__)("Saved as draft.","wporg-patterns")),(0,o.__)("This pattern is only visible to you. When you’re ready, submit it to be published to everyone.","wporg-patterns"))),r&&(0,a
 .createElement)(_e.Modal,{title:(0,o.__)("Drafts","wporg-patterns"),onRequestClose:s,className:"pattern__status-notice-modal"},(0,a.createElement)("p",null,(0,o.__)("Patterns can be saved as a draft which can be submitted for approval at any time. This allows you to save your design and come back to it later to submit.","wporg-patterns"))));case"unlisted":return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(_e.Notice,{className:"pattern__status-notice",status:"error",isDismissible:!1,actions:[{label:(0,o.__)("Learn More","wporg-patterns"),onClick:i,variant:"secondary"}]},(0,a.createElement)("p",null,(0,a.createElement)("strong",null,(0,o.__)("Pattern declined.","wporg-patterns")),(0,o.__)("WordPress.org has chosen not to include this pattern in the directory.","wporg-patterns"))),r&&(0,a.c
 reateElement)(_e.Modal,{title:(0,o.__)("Declined","wporg-patterns"),onRequestClose:s,className:"pattern__status-notice-modal"},(0,a.createElement)("p",null,(0,o.__)("WordPress.org has removed your pattern from the directory for the following reason:","wporg-patterns")),(0,a.createElement)("p",null,(0,a.createElement)("em",{dangerouslySetInnerHTML:{__html:t.unlisted_reason?.description||(0,o.__)("This pattern doesn't meet the guidelines for the pattern directory.","wporg-patterns")}})),(0,a.createElement)("p",null,(0,o.__)("You can update your pattern to resubmit it for approval at any time.","wporg-patterns"))));case"publish":return(0,a.createElement)(_e.Notice,{className:"pattern__status-notice",status:"success",isDismissible:!1},(0,a.createElement)("p",null,(0,a.createElement)("strong",null,(0,o.__)(&quo
 t;Pattern published!","wporg-patterns")),(0,o.__)("Your new design is now available to everyone.","wporg-patterns")))}return null}const Ht=e=>{let{postId:t,userHasReported:r}=e;t=Number(t)||0;const{pattern:n,categories:c}=(0,s.useSelect)((e=>{const r=e(fe).getPattern(t),n=e(fe).getCategories()||[],a=r?.["pattern-categories"].map((e=>n.find((t=>{let{id:r}=t;return r===e})))).filter(Boolean);return{pattern:r,categories:a||[]}}),[t]);if(!n)return null;const u=window.wporgPatternsData.userId===n.author;return(0,a.createElement)(a.Fragment,null,(0,a.createElement)("header",{className:"entry-header"},u&&(0,a.createElement)(zt,{pattern:n}),(0,a.createElement)("h1",{className:"entry-title"},(0,i.decodeEntities)(n.title.rendered)),(0,a.createElement)("div",{className:"pattern__categories"},c.map((e=>{let{id:t,name:r,link:n}=e;return(0,a.createElement)("a",
 {href:n,key:t},(0,i.decodeEntities)(r))})))),(0,a.createElement)(Lt,{postId:t,showOptions:u}),(0,a.createElement)("div",{className:"pattern-preview__container"},(0,a.createElement)(vt,{pattern:n}),(0,a.createElement)("div",{className:"pattern__meta"},(0,a.createElement)(Wt,{userHasReported:"true"===r,postId:t}))),(0,a.createElement)("div",{className:"pattern__related-patterns"},(0,a.createElement)(he,{query:{author:n.author,per_page:3,exclude:t},showPagination:!1,header:(0,a.createElement)(a.Fragment,null,(0,a.createElement)("h2",null,(0,o.__)("More from this designer","wporg-patterns")),(0,a.createElement)(l,n.author_meta))},(e=>(0,a.createElement)(qt,{key:e.id,pattern:e})))))},Yt=e=>{const t=document.getElementById("breadcrumb-part");t&&(t.innerText=e)},Xt=()=>{const{path:e}=T(),{authorName:t,categoryName:r}=(0,s.useSelect)((t=>{const r=t(fe).getQueryFr
 omUrl(e),n=t(fe).getCategoryById(r["pattern-categories"]);return{authorName:wporgPatternsData.currentAuthorName||r?.author_name,categoryName:n?.name}}),[]);return(0,a.useEffect)((()=>{t?
</span><span class="cx" style="display: block; padding: 0 10px"> // translators: %s is the author name.
</span><span class="cx" style="display: block; padding: 0 10px"> Yt((0,o.sprintf)((0,o.__)("Author: %s","wporg-patterns"),t)):r&&
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -16,7 +16,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> (0,o._n)("%1$d pattern found for <b>%2$s</b>","%1$d patterns found for <b>%2$s</b>",e,"wporg-patterns"),e,t.replace(/\+/g," "),"wporg-patterns"),{b:(0,a.createElement)("b",null)}))(u,e)):(n(((e,t)=>{let{category:r,author:n}=e;return r&&n?(0,a.createInterpolateElement)((0,o.sprintf)(/* translators: %1$d: number of patterns, %2$s category name, %3$s author name. */
</span><span class="cx" style="display: block; padding: 0 10px"> (0,o._n)("%1$d <b>%2$s</b> pattern by %3$s.","%1$d <b>%2$s</b> patterns by %3$s.",t,"wporg-patterns"),t,r,n),{b:(0,a.createElement)("b",null)}):r?(0,a.createInterpolateElement)((0,o.sprintf)(/* translators: %1$d: number of patterns, %2$s category name. */
</span><span class="cx" style="display: block; padding: 0 10px"> (0,o._n)("%1$d <b>%2$s</b> pattern.","%1$d <b>%2$s</b> patterns.",t,"wporg-patterns"),t,r,"wporg-patterns"),{b:(0,a.createElement)("b",null)}):n?(0,a.createInterpolateElement)((0,o.sprintf)(/* translators: %1$d: number of patterns, %2$s author name. */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-(0,o._n)("%1$d pattern by <b>%2$s</b>.","%1$d patterns by <b>%2$s</b>.",t,"wporg-patterns"),t,n),{b:(0,a.createElement)("b",null)}):(0,o.__)("Loading patterns","wporg-patterns")})({category:c?.name,author:l},u)),g?.include&&!c&&n(""))}),[g,p]);const m=Et()({"context-bar__spinner":!0,"context-bar__spinner--is-hidden":!p||e.isEmpty});return(0,a.createElement)("div",{className:r?null:"screen-reader-text"},(0,a.createElement)("header",{className:"context-bar","aria-live":"polite","aria-atomic":"true",tabIndex:"0"},(0,a.createElement)("h2",{className:"context-bar__copy"},(0,a.createElement)("span",{className:m},(0,a.createElement)(_e.Spinner,null)
 ),(0,a.createElement)("span",null,r||(0,o.__)("All patterns.","wporg-patterns")),d&&(0,a.createElement)("span",{className:"screen-reader-text"},d)),i.links&&i.links.length>0&&(0,a.createElement)("div",{className:"context-bar__links"},(0,a.createElement)("h3",{className:"context-bar__title"},i.title),(0,a.createElement)("ul",null,i.links.map((e=>(0,a.createElement)("li",{key:e.href},(0,a.createElement)("a",{href:e.href},e.label))))))))},ar=()=>{const{path:e}=T(),t=(0,s.useSelect)((t=>{const r=t(fe).getQueryFromUrl(e),n=t(fe).getCategoryById(r["pattern-categories"])?.name,a=wporgPatternsData.currentAuthorName||r?.author_name,i=P(e),s=w(e).replace(/^\/patterns/,"").split("/")[1]||"",l=[];return"categories"===s&&n?l.push(/* translators: Taxonomy term name */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+(0,o._n)("%1$d pattern by <b>%2$s</b>.","%1$d patterns by <b>%2$s</b>.",t,"wporg-patterns"),t,n),{b:(0,a.createElement)("b",null)}):(0,o.__)("Loading patterns","wporg-patterns")})({category:c?.name,author:l},u)),g?.include&&!c&&n(""))}),[g,p]);const m=Et()({"context-bar__spinner":!0,"context-bar__spinner--is-hidden":!p||e.isEmpty});return(0,a.createElement)("div",{className:r?null:"screen-reader-text"},(0,a.createElement)("header",{className:"context-bar","aria-live":"polite","aria-atomic":"true",tabIndex:"0"},(0,a.createElement)("h2",{className:"context-bar__copy"},(0,a.createElement)("span",{className:m},(0,a.createElement)(_e.Spinner,null))
 ,(0,a.createElement)("span",null,r||(0,o.__)("All patterns.","wporg-patterns")),d&&(0,a.createElement)("span",{className:"screen-reader-text"},d)),i.links&&i.links.length>0&&(0,a.createElement)("div",{className:"context-bar__links"},(0,a.createElement)("h3",{className:"context-bar__title"},i.title),(0,a.createElement)("ul",null,i.links.map((e=>(0,a.createElement)("li",{key:e.href},(0,a.createElement)("a",{href:e.href},e.label))))))))},ar=()=>{const{path:e}=T(),t=(0,s.useSelect)((t=>{const r=t(fe).getQueryFromUrl(e),n=t(fe).getCategoryById(r["pattern-categories"])?.name,a=wporgPatternsData.currentAuthorName||r?.author_name,i=S(e),s=w(e).replace(/^\/patterns/,"").split("/")[1]||"",l=[];return"categories"===s&&n?l.push(/* translators: Taxonomy term name */
</ins><span class="cx" style="display: block; padding: 0 10px"> (0,o.sprintf)((0,o.__)("Block Patterns: %s","wporg-patterns"),n)):"author"===s&&a?l.push(/* translators: Author name */
</span><span class="cx" style="display: block; padding: 0 10px"> (0,o.sprintf)((0,o.__)("Block Patterns by %s","wporg-patterns"),a)):l.push((0,o.__)("Block Pattern Directory","wporg-patterns")),i>1&&l.push(/* translators: Page number */
</span><span class="cx" style="display: block; padding: 0 10px"> (0,o.sprintf)((0,o.__)("Page %d","wporg-patterns"),i)),l.push((0,o.__)("WordPress.org","wporg-patterns")+` ${wporgLocale.displayName}`),l.join(" | ")}));return(0,a.useEffect)((()=>{t&&(document.title=t)}),[t]),null},or=function(){return(0,a.createElement)("div",{className:"pattern-grid__empty-header"},(0,a.createElement)("h2",null,(0,o.__)("No results found","wporg-patterns")),(0,a.createElement)("p",null,(0,a.createInterpolateElement)((0,o.__)("View <a>all block patterns</a> or browse some of our recent patterns.","wporg-patterns"),{a:(0,a.createElement)("a",{href:wporgPatternsUrl.site})})))},ir=e=>{let{options:t}=e;const{path:r,replace:n}=T(),i=(0,ve.useViewportMatch)("medium",">=");return t?(0,a.createElement)("div",{clas
 sName:"pattern-order-select"},(0,a.createElement)(_e.SelectControl,{label:(0,o.__)("Order by","wporg-patterns"),labelPosition:"side",hideLabelFromVision:i,value:(0,_.getQueryArg)(window.location.href,"orderby"),options:t,onChange:e=>{n((0,_.addQueryArgs)(r,{orderby:e}).replace(/\/page\/[\d]+/,""))}})):null},sr=()=>(0,a.createElement)(c,{className:"pattern-menu",style:{flexDirection:"row"}},Array(7).fill().map(((e,t)=>(0,a.createElement)(u,{key:t,height:"1.25rem",width:"5rem",marginRight:"1rem"})))),lr=e=>{let{current:t,isLoading:r,label:n=(0,o.__)("Main Menu","wporg-patterns"),onClick:i,options:s}=e;return r?(0,a.createElement)(sr,null):s.length?(0,a.createElement)("nav",null,(0,a.createElement)("h2",{className:"screen-reader-text"},n),(0,a.createElement)("ul",{className:"pattern-menu"},s.map((
 e=>(0,a.createElement)("li",{key:e.value},(0,a.createElement)("a",{className:Et()({"pattern-menu__item":!0,"is-active":t===e.slug}),href:e.value,onClick:i,"aria-current":t===e.slug?"page":void 0},e.label)))))):null},cr=e=>{let{onClick:t,options:r,label:n=(0,o.__)("Browse categories","wporg-patterns")}=e;const[i,s]=(0,a.useState)(!1);return(0,a.createElement)(_e.PanelBody,{className:"pattern-menu is-mobile",title:n,initialOpen:i,opened:i,onToggle:()=>s(!i)},(0,a.createElement)("ul",null,r.map((e=>(0,a.createElement)("li",{key:e.value},(0,a.createElement)("a",{href:e.value,onClick:e=>{s(!1),t(e)}},e.label))))))},ur=e=>(0,ve.useViewportMatch)("medium","<")?(0,a.createElement)(cr,e):(0,a.createElement)(lr,e),pr=e=>{let{primary:t,secondary:r}=e;return(0,a.createElement)("div",{className:"pattern-navigation-layou
 t"},t&&(0,a.createElement)("div",{className:"pattern-navigation-layout__primary"},t),r&&(0,a.createElement)("div",{className:"pattern-navigation-layout__secondary"},r))},dr=["","featured","query","text","gallery","call-to-action","banner","header","footer","wireframe"],gr=e=>{let{basePath:t="",onNavigation:r,...n}=e;const{path:i,update:l}=T(),{categorySlug:c,isLoading:u,options:p}=(0,s.useSelect)((e=>{const{getCategoryById:r,getCategories:n,getQueryFromUrl:a,getUrlFromQuery:o,isLoadingCategories:s}=e(fe),l=a(i);delete l.page;const c=n()||[],u=dr.map((e=>{const r=c.find((t=>t.slug===e));return!!r&&{value:o({...l,"pattern-categories":r.id},wporgPatternsUrl.site+t),slug:r.slug,label:r.name}})).filter(Boolean);return{categorySlug:r(l["pattern-categories"])?.slug||"",isL
 oading:s(),options:u}}));return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(pr,{primary:(0,a.createElement)(ur,{current:c,options:p||[],onClick:e=>{e.preventDefault(),l(e.target.pathname),"function"==typeof r&&r()},isLoading:u}),secondary:(0,a.createElement)(ir,{options:[{label:(0,o.__)("Newest","wporg-patterns"),value:"date"},{label:(0,o.__)("Popular","wporg-patterns"),value:"favorite_count"}]})}),(0,a.createElement)(nr,n))},mr=()=>{const{setCurrentQuery:e}=(0,s.useDispatch)(fe),{path:t}=T(),r=(0,s.useSelect)((e=>e(fe).getQueryFromUrl(t)),[t]);return tr((()=>{e(r)}),[r]),null},fr=window.wp.dom;function hr(){const e=(0,a.useRef)(),t=(0,a.useCallback)((()=>{if(!e?.current)return;const t=fr.focus.tabbable.find(e.current),r=t[t.length-1]||!1;r&&r.focus(),r.focus()}),[]);return[e,t]}const vr=function(e){let{isLoggedIn:t}=e;const r=(0,_.addQueryArgs)(wporgPatternsUrl.login,{red
 irect_to:window.location}),n=(0,_.addQueryArgs)(wporgPatternsUrl.register,{redirect_to:window.location});return t?(0,a.createElement)("div",{className:"pattern-grid__empty-header pattern-favorites__empty-header"},(0,a.createElement)("h2",null,(0,o.__)("Collect and view your favorite patterns.","wporg-patterns")),(0,a.createElement)("p",null,(0,o.__)("Tap the heart on any pattern to mark it as a favorite. All your favorite patterns will appear here.","wporg-patterns"))):(0,a.createElement)("div",{className:"pattern-grid__empty-header pattern-favorites__empty-header"},(0,a.createElement)("h2",null,(0,o.__)("Collect and view your favorite patterns.","wporg-patterns")),(0,a.createElement)("p",null,(0,o.__)("Log in to your WordPress.org account and you’ll be able to see all your favorite patterns in one place.","wporg-patterns")
 ),(0,a.createElement)("p",null,(0,a.createElement)("a",{className:"button button-primary button-large",href:r},(0,o.__)("Log in","wporg-patterns"))),(0,a.createElement)("p",null,(0,a.createElement)("a",{className:"button-link link-create-account",href:n},(0,o.__)("Create an account","wporg-patterns"))))};function _r(){const{path:e,update:t}=T();let r=E(e,"my-patterns");"page"===r&&(r="all");const n=[{value:`${wporgPatternsUrl.site}/my-patterns/`,slug:"all",label:(0,o.__)("All","wporg-patterns")},{value:`${wporgPatternsUrl.site}/my-patterns/draft/`,slug:"draft",label:(0,o.__)("Drafts","wporg-patterns")},{value:`${wporgPatternsUrl.site}/my-patterns/pending/`,slug:"pending",label:(0,o.__)("Pending Review","wporg-patterns")}];return(0,a.createElement)(ur,{label:(
 0,o.__)("Menu","wporg-patterns"),current:r||"all",options:n,onClick:e=>{e.preventDefault(),t(e.target.pathname)},isLoading:!1})}const yr=document.getElementById("patterns__container");yr&&(0,a.render)((0,a.createElement)((()=>{const{isEmpty:e,isSearch:t,query:r}=(0,s.useSelect)((e=>{const{getCurrentQuery:t,getPatternsByQuery:r,isLoadingPatternsByQuery:n}=e(fe),a=t(),o=a&&n(a),i=a?r(a):[];return{isEmpty:!o&&!i.length,isSearch:a&&!!a.search,query:a}})),[n,o]=hr();return(0,a.createElement)(k,null,(0,a.createElement)(ar,null),(0,a.createElement)(mr,null),(0,a.createElement)(Xt,null),(0,a.createElement)("div",{ref:n},t?(0,a.createElement)(nr,{query:r}):(0,a.createElement)(gr,{onNavigation:o})),e?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(or,null),(0,a.createElement)(he,{query:{per_page:6},showPagination:!1},(e=>(0,a.createElement)(qt,{key:e.id,pattern:e,showAvatar:!0})))):(0,a.creat
 eElement)(he,{query:r,onNavigation:o},(e=>(0,a.createElement)(qt,{key:e.id,pattern:e,showAvatar:!0}))))}),null),yr);const wr=document.getElementById("my-patterns__container");wr&&(0,a.render)((0,a.createElement)((()=>{const e=wporgPatternsData.userId,{isEmpty:t,query:r}=(0,s.useSelect)((t=>{const{getCurrentQuery:r,getPatternsByQuery:n,isLoadingPatternsByQuery:a}=t(fe),o={status:"any",...r()||{},author:e};"pending"===o.status&&(o.status="pending,pending-review");const i=e&&a(o),s=e?n(o):[];return{isEmpty:!i&&!s.length,query:o}}));if(!e){const e=(0,_.addQueryArgs)(wporgPatternsUrl.login,{redirect_to:window.location});return(0,a.createElement)("div",{className:"entry-content"},(0,a.createElement)("div",{className:"alignwide",style:{marginLeft:"auto",marginRight:"auto",maxWidth:960}},(0,a.createElement)("p",null,(0,o.__)("Please log 
 in to view your patterns.","wporg-patterns")),(0,a.createElement)("p",null,(0,a.createElement)("a",{className:"button button-primary button-large",href:e},(0,o.__)("Log in","wporg-patterns"))),(0,a.createElement)("div",{style:{height:100},"aria-hidden":"true",className:"wp-block-spacer"})))}return(0,a.createElement)(k,null,(0,a.createElement)(mr,null),(0,a.createElement)(pr,{primary:(0,a.createElement)(_r,null),secondary:(0,a.createElement)(ir,{options:[{label:(0,o.__)("Newest","wporg-patterns"),value:"date"},{label:(0,o.__)("Favorites","wporg-patterns"),value:"favorite_count"}]})}),t?(0,a.createElement)("div",{className:"pattern-grid__empty-header"},(0,a.createElement)("h2",null,(0,o.__)("Create and share patterns for every WordPress site.","wporg-patterns")),(0,a.create
 Element)("p",null,(0,o.__)("Anyone can create and share patterns using the familiar block editor. Design helpful starting points for yourself and any WordPress site.","wporg-patterns")),(0,a.createElement)(_e.Button,{variant:"primary",href:`${wporgPatternsUrl.site}/new-pattern/`},(0,o.__)("Create your first pattern","wporg-patterns"))):(0,a.createElement)(he,{query:r},(e=>(0,a.createElement)(qt,{key:e.id,pattern:e,showOptions:!0}))))}),null),wr);const Er=document.getElementById("pattern-favorites__container");Er&&(0,a.render)((0,a.createElement)((()=>{const{isEmpty:e,query:t}=(0,s.useSelect)((e=>{const{getCurrentQuery:t,getFavorites:r,getPatternsByQuery:n,isLoadingPatternsByQuery:a}=e(fe),o=t()||{},i=r();if(null===i)return{query:!1,isEmpty:!1};const s={...o,include:i},l=!!i.length&&a(s),c=i.length?n(s):[];return{query:s,isEmpty:!l&&!c.length}})),[r,n]=hr(),i={orderby:"favorite
 _count",per_page:6};t["pattern-categories"]&&(i["pattern-categories"]=t["pattern-categories"]);const l=!!wporgPatternsData.userId;return(0,a.createElement)(k,null,(0,a.createElement)(mr,null),(0,a.createElement)("div",{ref:r},l&&(0,a.createElement)(gr,{basePath:"/favorites/",query:t,onNavigation:n,isEmpty:e})),!l||e?(0,a.createElement)(a.Fragment,null,(0,a.createElement)(vr,{isLoggedIn:l}),(0,a.createElement)(he,{header:(0,a.createElement)("h2",{className:"pattern-favorites__grid-title"},(0,o.__)("Here’s a few of our favorite patterns","wporg-patterns")),query:i,showPagination:!1},(e=>(0,a.createElement)(qt,{key:e.id,pattern:e,showAvatar:!0})))):(0,a.createElement)(he,{query:t,onNavigation:n},(e=>(0,a.createElement)(qt,{key:e.id,pattern:e,showAvatar:!0}))))}),null),Er);const br=document.querySelectorAll(".pattern__container");for(let e=0;e<br.length;e++
 ){const t=br[e],r=t.dataset;(0,a.render)((0,a.createElement)(Ht,r),t,(()=>{t.hidden=!1,document.querySelectorAll(".hide-if-pattern-loaded").forEach((e=>e.hidden=!0))}))}})()})();
</span><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentthemespubwporgpatternssrccomponentspatternthumbnailscreenshotjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/pattern-thumbnail/screenshot.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/pattern-thumbnail/screenshot.js 2023-04-03 05:26:02 UTC (rev 12524)
+++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/src/components/pattern-thumbnail/screenshot.js   2023-04-03 21:02:06 UTC (rev 12525)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5,7 +5,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> import { __ } from '@wordpress/i18n';
</span><span class="cx" style="display: block; padding: 0 10px"> import { addQueryArgs } from '@wordpress/url';
</span><span class="cx" style="display: block; padding: 0 10px"> import { Spinner } from '@wordpress/components';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-import { useState } from '@wordpress/element';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+import { useEffect, useState } from '@wordpress/element';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * Internal dependencies
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -17,7 +17,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * Module constants
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> const MAX_ATTEMPTS = 10;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-const RETRY_DELAY = 1000;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+const RETRY_DELAY = 2000;
</ins><span class="cx" style="display: block; padding: 0 10px"> const VIEWPORT_WIDTH = 1200;
</span><span class="cx" style="display: block; padding: 0 10px"> const IMAGE_WIDTH = 600;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -46,6 +46,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        const [ hasLoaded, setHasLoaded ] = useState( false );
</span><span class="cx" style="display: block; padding: 0 10px">        const [ hasError, setHasError ] = useState( false );
</span><span class="cx" style="display: block; padding: 0 10px">        const [ base64Img, setBase64Img ] = useState( '' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        const [ shouldRetry, setShouldRetry ] = useState( false );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        // We don't want to keep trying infinitely.
</span><span class="cx" style="display: block; padding: 0 10px">        const hasAborted = attempts > MAX_ATTEMPTS;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -68,6 +69,30 @@
</span><span class="cx" style="display: block; padding: 0 10px">                reader.readAsDataURL( blob );
</span><span class="cx" style="display: block; padding: 0 10px">        };
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        const fetchImage = async () => {
+               try {
+                       const res = await fetch( fullUrl );
+
+                       if ( res.redirected ) {
+                               setShouldRetry( true );
+                       } else if ( res.status === 200 && ! res.redirected ) {
+                               await convertResponseToBase64( res );
+
+                               setHasLoaded( true );
+                               setShouldRetry( false );
+                       } else {
+                               setAttempts( attempts + 1 );
+                       }
+               } catch ( error ) {
+                       setHasError( true );
+                       setShouldRetry( false );
+               }
+       };
+
+       useEffect( () => {
+               ( async () => await fetchImage() )();
+       }, [] );
+
</ins><span class="cx" style="display: block; padding: 0 10px">         /**
</span><span class="cx" style="display: block; padding: 0 10px">         * The Snapshot service will redirect when its generating an image.
</span><span class="cx" style="display: block; padding: 0 10px">         * We want to continue requesting the image until it doesn't redirect.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -74,21 +99,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        useInterval(
</span><span class="cx" style="display: block; padding: 0 10px">                async () => {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        try {
-                               const res = await fetch( fullUrl );
-
-                               if ( res.status === 200 && ! res.redirected ) {
-                                       await convertResponseToBase64( res );
-
-                                       setHasLoaded( true );
-                               } else {
-                                       setAttempts( attempts + 1 );
-                               }
-                       } catch ( error ) {
-                               setHasError( true );
-                       }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 await fetchImage();
</ins><span class="cx" style="display: block; padding: 0 10px">                 },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                isLoading ? RETRY_DELAY : null
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         shouldRetry ? RETRY_DELAY : null
</ins><span class="cx" style="display: block; padding: 0 10px">         );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        if ( ! isReady ) {
</span></span></pre>
</div>
</div>

</body>
</html>