WordPress.org

Making WordPress.org

Changeset 11137


Ignore:
Timestamp:
07/20/2021 05:36:06 AM (3 months ago)
Author:
dufresnesteven
Message:

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

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

Legend:

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

    r11124 r11137  
    1 <?php return array('dependencies' => array('lodash', 'react', 'wp-a11y', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-data-controls', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '74b7cd5096f16b9b55bcff892ce4141c');
     1<?php return array('dependencies' => array('lodash', 'react', 'wp-a11y', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-data-controls', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '1a2f824953a82f83723b6428397bfe53');
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/build/index.js

    r11124 r11137  
    1 !function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=17)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.url},function(e,t){e.exports=window.wp.components},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wp.dataControls},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function a(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var o=typeof r;if("string"===o||"number"===o)e.push(r);else if(Array.isArray(r)){if(r.length){var c=a.apply(null,r);c&&e.push(c)}}else if("object"===o)if(r.toString===Object.prototype.toString)for(var i in r)n.call(r,i)&&r[i]&&e.push(i);else e.push(r.toString())}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(r=function(){return a}.apply(t,[]))||(e.exports=r)}()},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wp.primitives},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.exports.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.a11y},function(e,t){e.exports=window.wp.keycodes},function(e,t){e.exports=window.wp.coreData},function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.lodash},function(e,t){e.exports=window.wp.apiFetch},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"fetchPatterns",(function(){return N})),n.d(r,"loadPattern",(function(){return k})),n.d(r,"loadPatterns",(function(){return C})),n.d(r,"setErrorPatterns",(function(){return A})),n.d(r,"setCurrentQuery",(function(){return I})),n.d(r,"fetchCategories",(function(){return L})),n.d(r,"loadCategories",(function(){return R})),n.d(r,"fetchPatternFlagReasons",(function(){return D})),n.d(r,"loadPatternFlagReasons",(function(){return F})),n.d(r,"loadFavorites",(function(){return M})),n.d(r,"addFavorite",(function(){return B})),n.d(r,"removeFavorite",(function(){return Q}));var a={};n.r(a),n.d(a,"getPatternsByQuery",(function(){return H})),n.d(a,"getPattern",(function(){return $})),n.d(a,"getCategories",(function(){return z})),n.d(a,"getPatternFlagReasons",(function(){return W})),n.d(a,"getFavorites",(function(){return Y}));var o={};n.r(o),n.d(o,"isLoadingPatternsByQuery",(function(){return X})),n.d(o,"getPatterns",(function(){return J})),n.d(o,"getPatternsByQuery",(function(){return Z})),n.d(o,"getPatternTotalsByQuery",(function(){return ee})),n.d(o,"getPatternTotalPagesByQuery",(function(){return te})),n.d(o,"getPattern",(function(){return ne})),n.d(o,"getCurrentQuery",(function(){return re})),n.d(o,"isLoadingCategories",(function(){return ae})),n.d(o,"hasLoadedCategories",(function(){return oe})),n.d(o,"getCategories",(function(){return ce})),n.d(o,"getCategoryBySlug",(function(){return ie})),n.d(o,"getPatternFlagReasons",(function(){return se})),n.d(o,"isLoadingPatternFlagReasons",(function(){return le})),n.d(o,"getFavorites",(function(){return ue})),n.d(o,"isFavorite",(function(){return pe}));var c=n(0),i=n(1),s=n(2),l=({name:e,url:t,avatar:n})=>Object(c.createElement)("a",{href:t,className:"pattern__author-avatar"},Object(c.createElement)("img",{alt:"",src:n}),e);const u=({className:e="",style:t,children:n})=>Object(c.createElement)("span",{className:e+" pattern-skeleton__container",style:t},n),p=e=>Object(c.createElement)("span",{className:"pattern-skeleton",style:e});var d=n(10),f=n.n(d),m=n(9),b=function(e){return Object(c.createElement)(m.SVG,f()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),Object(c.createElement)(m.Path,{d:"M11.941 21.175l-1.443-1.32c-5.124-4.67-8.508-7.75-8.508-11.53 0-3.08 2.408-5.5 5.473-5.5 1.732 0 3.394.81 4.478 2.09 1.085-1.28 2.747-2.09 4.478-2.09 3.065 0 5.473 2.42 5.473 5.5 0 3.78-3.383 6.86-8.508 11.54l-1.443 1.31z"}))};function g(e){return e*(2/3)}const v=()=>{const[e,t]=Object(c.useState)(),n=Object(c.useRef)();return Object(c.useEffect)(()=>{n.current&&t(g(n.current.clientWidth)+"px")},[n]),Object(c.createElement)("div",{ref:n},Object(c.createElement)(u,null,Object(c.createElement)(p,{height:e}),Object(c.createElement)(p,{height:"14px",marginTop:"1rem"}),Object(c.createElement)(u,{style:{flexDirection:"row",marginTop:"0.5rem",alignItems:"center"}},Object(c.createElement)(p,{height:"18px",width:"18px",marginRight:"0.5rem",borderRadius:"32px"}),Object(c.createElement)(p,{height:"12px",width:"100px",marginRight:"0.75rem"}),Object(c.createElement)(b,{width:"16px",height:"16px",fill:"#787c82",className:"pattern-favorite-button__filled"}),Object(c.createElement)(p,{height:"12px",width:"32px",marginLeft:"0.5rem"}))))};var h=({length:e=6})=>Array(e).fill().map((e,t)=>Object(c.createElement)(v,{key:t})),O=n(3);const y=e=>e.split("?")[0],j=(e,t)=>{if(!t||!e)return"";const n=Object(O.getQueryArgs)(e);if(n[t])return n[t];const r=(e=>e.replace(/^\//,""))(y(e).replace(/\/$/,"")).split("/"),a=r.indexOf(t);return-1===a?"":r[a+1]||""},_=e=>j(e,"pattern-categories"),w=e=>decodeURI(j(e,"search")),E=Object(c.createContext)();function S({children:e}){const[t,n]=Object(c.useState)(Object(O.getPathAndQueryString)(window.location.href)),r=e=>{window.history.pushState("","",e),n(e)},a=()=>{n(document.location.href)};return Object(c.useEffect)(()=>(window.addEventListener("popstate",a),()=>{window.removeEventListener("popstate",a)}),[]),Object(c.createElement)(E.Provider,{value:{path:t,update:e=>{const n=(e=>(e=>{const t={};return Object.keys(e).forEach(n=>{const r=e[n];null!=r&&r.toString().length>0&&(t[n]=r)}),t})({...Object(O.getQueryArgs)(t),...Object(O.getQueryArgs)(e)}))(e),a=y(e),o=Object(O.addQueryArgs)(a,n);r(o)},replace:r}},e)}function P(){const e=Object(c.useContext)(E);if(void 0===e)throw new Error("useRoute must be used within a Provider");return e}function x({currentPage:e=1,totalPages:t}){const{path:n,update:r}=P();if(!t||t<=1)return null;const a=e>1,o=e<t,s=Object(O.getQueryString)(n)?"?"+Object(O.getQueryString)(n):"",l=n.replace(s,"").replace(/page\/\d+\/?/,""),u=function(e,t=1){const n=Array.from({length:e},(e,t)=>t+1),r=[];return e<=5?n:(r.push(...n.slice(0,2)),t>=2&&t<=e-1&&r.push(...n.slice(t-2,t+1)),r.push(...n.slice(-2)),r.filter((e,t,n)=>n.indexOf(e)===t).reduce((e,t,n,r)=>{if(0===n)return e.push(t),e;const a=Math.abs(r[n]-r[n-1]);return 0===a||(a>1&&e.push("…"),e.push(t)),e},[]))}(t,e),p=`${l}page/%s/${s}`,d=e=>1===e?`${l}${s}`:Object(i.sprintf)(p,e),f=(e,t)=>{e.preventDefault(),r(d(t))};return Object(c.createElement)("nav",{className:"pagination","aria-label":Object(i.__)("Pagination","wporg-patterns")},Object(c.createElement)("ul",{className:"pagination__list"},Object(c.createElement)("li",{className:"pagination__item pagination__item-previous-page"},a&&Object(c.createElement)("a",{className:"pagination__link",href:d(e-1),onClick:t=>f(t,e-1)},Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.__)("Previous page","wporg-patterns")),Object(c.createElement)("span",{"aria-hidden":!0},Object(i._x)("Previous","previous page link label","wporg-patterns")))),u.map((t,n)=>"…"===t?Object(c.createElement)("li",{className:"pagination__item",key:`${n}-${t}`},t):Object(c.createElement)("li",{className:"pagination__item",key:t},Object(c.createElement)("a",{className:"pagination__link",href:d(t),"aria-current":t===e?"page":void 0,onClick:e=>f(e,t)},Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.sprintf)(// translators: %s is the page number.
     1!function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=17)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.url},function(e,t){e.exports=window.wp.components},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wp.dataControls},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function a(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var o=typeof r;if("string"===o||"number"===o)e.push(r);else if(Array.isArray(r)&&r.length){var c=a.apply(null,r);c&&e.push(c)}else if("object"===o)for(var i in r)n.call(r,i)&&r[i]&&e.push(i)}}return e.join(" ")}e.exports?(a.default=a,e.exports=a):void 0===(r=function(){return a}.apply(t,[]))||(e.exports=r)}()},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wp.primitives},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.exports.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.a11y},function(e,t){e.exports=window.wp.keycodes},function(e,t){e.exports=window.wp.coreData},function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.lodash},function(e,t){e.exports=window.wp.apiFetch},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"fetchPatterns",(function(){return N})),n.d(r,"loadPattern",(function(){return k})),n.d(r,"loadPatterns",(function(){return C})),n.d(r,"setErrorPatterns",(function(){return A})),n.d(r,"setCurrentQuery",(function(){return I})),n.d(r,"fetchCategories",(function(){return L})),n.d(r,"loadCategories",(function(){return R})),n.d(r,"fetchPatternFlagReasons",(function(){return D})),n.d(r,"loadPatternFlagReasons",(function(){return F})),n.d(r,"loadFavorites",(function(){return M})),n.d(r,"addFavorite",(function(){return B})),n.d(r,"removeFavorite",(function(){return Q}));var a={};n.r(a),n.d(a,"getPatternsByQuery",(function(){return H})),n.d(a,"getPattern",(function(){return $})),n.d(a,"getCategories",(function(){return z})),n.d(a,"getPatternFlagReasons",(function(){return W})),n.d(a,"getFavorites",(function(){return Y}));var o={};n.r(o),n.d(o,"isLoadingPatternsByQuery",(function(){return X})),n.d(o,"getPatterns",(function(){return J})),n.d(o,"getPatternsByQuery",(function(){return Z})),n.d(o,"getPatternTotalsByQuery",(function(){return ee})),n.d(o,"getPatternTotalPagesByQuery",(function(){return te})),n.d(o,"getPattern",(function(){return ne})),n.d(o,"getCurrentQuery",(function(){return re})),n.d(o,"isLoadingCategories",(function(){return ae})),n.d(o,"hasLoadedCategories",(function(){return oe})),n.d(o,"getCategories",(function(){return ce})),n.d(o,"getCategoryBySlug",(function(){return ie})),n.d(o,"getPatternFlagReasons",(function(){return se})),n.d(o,"isLoadingPatternFlagReasons",(function(){return le})),n.d(o,"getFavorites",(function(){return ue})),n.d(o,"isFavorite",(function(){return pe}));var c=n(0),i=n(1),s=n(2),l=({name:e,url:t,avatar:n})=>Object(c.createElement)("a",{href:t,className:"pattern__author-avatar"},Object(c.createElement)("img",{alt:"",src:n}),e);const u=({className:e="",style:t,children:n})=>Object(c.createElement)("span",{className:e+" pattern-skeleton__container",style:t},n),p=e=>Object(c.createElement)("span",{className:"pattern-skeleton",style:e});var d=n(10),f=n.n(d),m=n(9),b=function(e){return Object(c.createElement)(m.SVG,f()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},e),Object(c.createElement)(m.Path,{d:"M11.941 21.175l-1.443-1.32c-5.124-4.67-8.508-7.75-8.508-11.53 0-3.08 2.408-5.5 5.473-5.5 1.732 0 3.394.81 4.478 2.09 1.085-1.28 2.747-2.09 4.478-2.09 3.065 0 5.473 2.42 5.473 5.5 0 3.78-3.383 6.86-8.508 11.54l-1.443 1.31z"}))};function g(e){return e*(2/3)}const v=()=>{const[e,t]=Object(c.useState)(),n=Object(c.useRef)();return Object(c.useEffect)(()=>{n.current&&t(g(n.current.clientWidth)+"px")},[n]),Object(c.createElement)("div",{ref:n},Object(c.createElement)(u,null,Object(c.createElement)(p,{height:e}),Object(c.createElement)(p,{height:"14px",marginTop:"1rem"}),Object(c.createElement)(u,{style:{flexDirection:"row",marginTop:"0.5rem",alignItems:"center"}},Object(c.createElement)(p,{height:"18px",width:"18px",marginRight:"0.5rem",borderRadius:"32px"}),Object(c.createElement)(p,{height:"12px",width:"100px",marginRight:"0.75rem"}),Object(c.createElement)(b,{width:"16px",height:"16px",fill:"#787c82",className:"pattern-favorite-button__filled"}),Object(c.createElement)(p,{height:"12px",width:"32px",marginLeft:"0.5rem"}))))};var h=({length:e=6})=>Array(e).fill().map((e,t)=>Object(c.createElement)(v,{key:t})),O=n(3);const y=e=>e.split("?")[0],j=(e,t)=>{if(!t||!e)return"";const n=Object(O.getQueryArgs)(e);if(n[t])return n[t];const r=(e=>e.replace(/^\//,""))(y(e).replace(/\/$/,"")).split("/"),a=r.indexOf(t);return-1===a?"":r[a+1]||""},_=e=>j(e,"pattern-categories"),w=e=>decodeURI(j(e,"search")),E=Object(c.createContext)();function S({children:e}){const[t,n]=Object(c.useState)(Object(O.getPathAndQueryString)(window.location.href)),r=e=>{window.history.pushState("","",e),n(e)},a=()=>{n(document.location.href)};return Object(c.useEffect)(()=>(window.addEventListener("popstate",a),()=>{window.removeEventListener("popstate",a)}),[]),Object(c.createElement)(E.Provider,{value:{path:t,update:e=>{const n=(e=>(e=>{const t={};return Object.keys(e).forEach(n=>{const r=e[n];null!=r&&r.toString().length>0&&(t[n]=r)}),t})({...Object(O.getQueryArgs)(t),...Object(O.getQueryArgs)(e)}))(e),a=y(e),o=Object(O.addQueryArgs)(a,n);r(o)},replace:r}},e)}function P(){const e=Object(c.useContext)(E);if(void 0===e)throw new Error("useRoute must be used within a Provider");return e}function x({currentPage:e=1,totalPages:t}){const{path:n,update:r}=P();if(!t||t<=1)return null;const a=e>1,o=e<t,s=Object(O.getQueryString)(n)?"?"+Object(O.getQueryString)(n):"",l=n.replace(s,"").replace(/page\/\d+\/?/,""),u=function(e,t=1){const n=Array.from({length:e},(e,t)=>t+1),r=[];return e<=5?n:(r.push(...n.slice(0,2)),t>=2&&t<=e-1&&r.push(...n.slice(t-2,t+1)),r.push(...n.slice(-2)),r.filter((e,t,n)=>n.indexOf(e)===t).reduce((e,t,n,r)=>{if(0===n)return e.push(t),e;const a=Math.abs(r[n]-r[n-1]);return 0===a||(a>1&&e.push("…"),e.push(t)),e},[]))}(t,e),p=`${l}page/%s/${s}`,d=e=>1===e?`${l}${s}`:Object(i.sprintf)(p,e),f=(e,t)=>{e.preventDefault(),r(d(t))};return Object(c.createElement)("nav",{className:"pagination","aria-label":Object(i.__)("Pagination","wporg-patterns")},Object(c.createElement)("ul",{className:"pagination__list"},Object(c.createElement)("li",{className:"pagination__item pagination__item-previous-page"},a&&Object(c.createElement)("a",{className:"pagination__link",href:d(e-1),onClick:t=>f(t,e-1)},Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.__)("Previous page","wporg-patterns")),Object(c.createElement)("span",{"aria-hidden":!0},Object(i._x)("Previous","previous page link label","wporg-patterns")))),u.map((t,n)=>"…"===t?Object(c.createElement)("li",{className:"pagination__item",key:`${n}-${t}`},t):Object(c.createElement)("li",{className:"pagination__item",key:t},Object(c.createElement)("a",{className:"pagination__link",href:d(t),"aria-current":t===e?"page":void 0,onClick:e=>f(e,t)},Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.sprintf)(// translators: %s is the page number.
    22Object(i.__)("Page %s","wporg-patterns"),t)),Object(c.createElement)("span",{"aria-hidden":!0},t)))),Object(c.createElement)("li",{className:"pagination__item pagination__item-next-page"},o&&Object(c.createElement)("a",{className:"pagination__link",href:d(e+1),onClick:t=>f(t,e+1)},Object(c.createElement)("span",{className:"screen-reader-text"},Object(i.__)("Next page","wporg-patterns")),Object(c.createElement)("span",{"aria-hidden":!0},Object(i._x)("Next","next page link label","wporg-patterns"))))))}var T=n(6);function N(e){return{type:"FETCH_BLOCK_PATTERNS",query:e}}function k(e,t){return{type:"LOAD_BLOCK_PATTERN",postId:e,pattern:t}}function C(e,{page:t,patterns:n,total:r,totalPages:a}){return{type:"LOAD_BLOCK_PATTERNS",query:e,page:t,patterns:n,total:r,totalPages:a}}function A(e,{page:t,error:n}){return{type:"ERROR_BLOCK_PATTERNS",query:e,page:t,error:n}}function I(e){return{type:"SET_CURRENT_QUERY",query:e}}function L(){return{type:"FETCH_CATEGORIES"}}function R(e){return{type:"LOAD_CATEGORIES",categories:e}}function D(){return{type:"FETCH_PATTERN_FLAG_REASONS"}}function F(e){return{type:"LOAD_PATTERN_FLAG_REASONS",reasons:e}}function M(e){return{type:"LOAD_FAVORITES",patternIds:e}}function*B(e){const t=yield Object(T.apiFetch)({path:"/wporg/v1/pattern-favorites",method:"POST",data:{id:e}});if("number"==typeof t)return{type:"ADD_FAVORITE",patternId:e,count:t}}function*Q(e){const t=yield Object(T.apiFetch)({path:"/wporg/v1/pattern-favorites",method:"DELETE",data:{id:e}});if("number"==typeof t)return{type:"REMOVE_FAVORITE",patternId:e,count:t}}function q(e={}){const t=Object.keys(e).sort();let n="";for(let r=0;r<t.length;r++){const a=t[r];let o=e[a];switch(Array.isArray(o)&&(o=e[a].join()),a){case"page":case"per_page":case"_fields":break;default:n+=(n?"&":"")+Object(O.addQueryArgs)("",{[a]:o}).slice(1)}}return n}function K(){return{id:-1,slug:"",name:Object(i.__)("All","wporg-patterns"),link:wporgPatternsUrl.site}}function V(e={},t){switch(t.type){case"LOAD_BLOCK_PATTERNS":{const n=(t.patterns||[]).reduce((e,t)=>({...e,[t.id]:t}),{});return{...e,...n}}case"LOAD_BLOCK_PATTERN":return{...e,[t.postId]:t.pattern};case"ADD_FAVORITE":case"REMOVE_FAVORITE":{const n={...e[t.patternId],favorite_count:t.count};return{...e,[t.patternId]:n}}default:return e}}function G(e={},t){const n=(t.patterns||[]).map(({id:e})=>e),{page:r,total:a,totalPages:o}=t;switch(t.type){case"LOAD_BLOCK_PATTERNS":{const c={...e[t.query]||{},total:a,totalPages:o};return c[r]=n,{...e,[t.query]:c}}case"ERROR_BLOCK_PATTERNS":{const n=e[t.query]||{};return n[r]=[],{...e,[t.query]:n}}default:return e}}var U=Object(s.combineReducers)({patterns:function(e={},t){return{byId:V(e.byId,t),queries:G(e.queries,t)}},categories:function(e,t){switch(t.type){case"FETCH_CATEGORIES":return null;case"LOAD_CATEGORIES":const e=(t.categories||[]).sort((e,t)=>e.name.localeCompare(t.name));return[K(),...e]}return e},currentQuery:function(e,t){switch(t.type){case"SET_CURRENT_QUERY":return t.query}return e},patternFlagReasons:function(e,t){switch(t.type){case"FETCH_PATTERN_FLAG_REASONS":return null;case"LOAD_PATTERN_FLAG_REASONS":return[...t.reasons];default:return e}},favorites:function(e=null,t){const{patternId:n}=t;switch(t.type){case"LOAD_FAVORITES":return t.patternIds;case"ADD_FAVORITE":return e.includes(n)?e:[...e,n];case"REMOVE_FAVORITE":return e.filter(e=>e!==n)}return e}});function*H(e){const t=q(e);try{yield N(t);const n=yield Object(T.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern",{...e,locale:JSON.parse(wporgLocale)}),parse:!1}),{total:r,totalPages:a,results:o}=yield Object(T.__unstableAwaitPromise)(async function(e){try{var t,n;return{total:Number((null===(t=e.headers)||void 0===t?void 0:t.get("X-WP-Total"))||0),totalPages:Number((null===(n=e.headers)||void 0===n?void 0:n.get("X-WP-TotalPages"))||0),results:await e.json()}}catch(e){return{}}}(n));yield C(t,{page:e.page||1,patterns:o,total:r,totalPages:a})}catch(n){const r=yield Object(T.__unstableAwaitPromise)(async function(e){try{return await e.json()}catch(e){return{}}}(n));yield A(t,{page:e.page||1,error:r})}}function*$(e){try{const t=yield Object(T.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern/"+e)});yield k(e,t)}catch(e){}}function*z(){try{yield{type:"FETCH_CATEGORIES"};const e=yield Object(T.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/pattern-categories")});yield R(e)}catch(e){}}function*W(){try{yield{type:"FETCH_PATTERN_FLAG_REASONS"};const e=yield Object(T.apiFetch)({path:Object(O.addQueryArgs)("/wp/v2/wporg-pattern-flag-reason")});yield F(e)}catch(e){}}function*Y(){try{const e=yield Object(T.apiFetch)({path:"/wporg/v1/pattern-favorites"});yield M(e)}catch(e){}}function X(e,t){var n,r;const a=q(t),o=(null==t?void 0:t.page)||1;return!Array.isArray(null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r[o])}function J(e){return Object.values(e.patterns.byId)}function Z(e,t){var n,r;const a=q(t),o=(null==t?void 0:t.page)||1;return((null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r[o])||[]).map(t=>e.patterns.byId[t])}function ee(e,t){var n,r;const a=q(t);return(null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r.total)||0}function te(e,t){var n,r;const a=q(t);return(null===(n=e.patterns.queries)||void 0===n||null===(r=n[a])||void 0===r?void 0:r.totalPages)||0}function ne(e,t){return e.patterns.byId[t]||null}function re(e){return e.currentQuery}function ae(e){return null===e.categories}function oe(e){return Array.isArray(e.categories)}function ce(e){return e.categories}function ie(e,t){if(!oe(e))return;const[n]=e.categories.filter(e=>e.slug===t);return n}function se(e){return e.patternFlagReasons}function le(e){return null===e.patternFlagReasons}function ue(e){return e.favorites}function pe(e,t){var n;return null===(n=e.favorites)||void 0===n?void 0:n.includes(t)}const de=Object(s.createReduxStore)("wporg/pattern-directory",{reducer:U,selectors:o,actions:r,controls:T.controls,resolvers:a});Object(s.register)(de);var fe=function({header:e,children:t,query:n,showPagination:r=!0}){const{isLoading:a,posts:o,totalPages:i}=Object(s.useSelect)(e=>{const{getPatternTotalPagesByQuery:t,getPatternsByQuery:r,isLoadingPatternsByQuery:a}=e(de);return{isLoading:n&&a(n),posts:n?r(n):[],totalPages:n?t(n):0}});return Object(c.createElement)(c.Fragment,null,o.length?e:null,Object(c.createElement)("div",{className:"pattern-grid"},a?Object(c.createElement)(h,{length:null==n?void 0:n.per_page}):o.map(t)),r&&Object(c.createElement)(x,{totalPages:i,currentPage:null==n?void 0:n.page}))},me=n(8),be=n(4);function ge(e){e.dir=document.dir,e.body.className="pattern-wrapper";for(const t of document.body.classList)t.startsWith("admin-color-")&&e.body.classList.add(t)}var ve=Object(c.forwardRef)((function({contentRef:e,children:t,head:n,headHTML:r,bodyStyle:a="",themeSlug:o="twentytwentyone",...s},l){const[u,p]=Object(c.useState)();r+=`<link rel="stylesheet" href="https://wp-themes.com/wp-content/themes/${o}/style.css" media="all" />`,r+=`<style>\n    body {\n        display: flex;\n        min-height: 100vh;\n        align-items: center;\n        justify-content: center;\n        background-color: white;\n    }\n    .pattern-wrapper {\n        padding: 0;\n        ${a}\n    }\n    body > div {\n        width: 100%;\n        max-height: 100%;\n        pointer-events: none;\n    }\n    </style>`;const d=Object(c.useCallback)(t=>{function n(){const{contentDocument:n}=t,{readyState:a,body:o}=n;return("interactive"===a||"complete"===a)&&("function"==typeof e?e(o):e&&(e.current=o),function(e,t){e.head.innerHTML="<style>body{margin:0}</style>"+t}(n,r),ge(n),function(e){const{defaultView:t}=e,{frameElement:n}=t;function r(e){const r=Object.getPrototypeOf(e).constructor.name,a=window[r],o={};for(const t in e)o[t]=e[t];if(e instanceof t.MouseEvent){const e=n.getBoundingClientRect();o.clientX+=e.left,o.clientY+=e.top}const c=new a(e.type,o);!n.dispatchEvent(c)&&e.preventDefault()}const a=["keydown","keypress","dragover"];for(const t of a)e.addEventListener(t,r)}(n),ge(n),p(n),!0)}t&&(n()||t.addEventListener("load",()=>{n()}))},[]);return Object(c.createElement)("iframe",f()({title:Object(i.__)("Pattern Preview","wporg-patterns"),tabIndex:"-1"},s,{ref:Object(me.useMergeRefs)([l,d])}),u&&Object(c.createPortal)(t,u.body),u&&Object(c.createPortal)(n,u.head))})),he=function({html:e}){return Object(c.createElement)("div",null,Object(c.createElement)(ve,{className:"pattern-preview__viewport-iframe",style:{width:"100%",height:"50vh",minHeight:"600px",overflowY:"auto"},headHTML:window.__editorStyles.html},Object(c.createElement)("div",{dangerouslySetInnerHTML:{__html:e}})))},Oe=n(5),ye=n.n(Oe);function je(e,t){return e.map((function(e,n){return e+t[n]}))}function _e(e,t){return e.map((function(e,n){return e-t[n]}))}function we(e){return Math.hypot.apply(Math,e)}function Ee(e){return Math.sign?Math.sign(e):Number(e>0)-Number(e<0)||+e}function Se(e,t,n){return 0===t||Math.abs(t)===1/0?function(e,t){return Math.pow(e,5*t)}(e,n):e*t*n/(t+n*e)}function Pe(e,t,n,r){return void 0===r&&(r=.15),0===r?function(e,t,n){return Math.max(t,Math.min(e,n))}(e,t,n):e<t?-Se(t-e,n-t,r)+t:e>n?+Se(e-n,n-t,r)+n:e}function xe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Te(){return(Te=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Ne(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function ke(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ae(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Ce(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ce(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function Ie(){}function Le(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?Ie:1===t.length?t[0]:function(){for(var e,n,r=Ae(t);!(n=r()).done;){var a=n.value;e=a.apply(this,arguments)||e}return e}}function Re(e,t){if(void 0===e){if(void 0===t)throw new Error("Must define fallback value if undefined is expected");e=t}return Array.isArray(e)?e:[e,e]}function De(e){if("function"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.apply(void 0,n)}return e}function Fe(e,t){void 0===e&&(e={});for(var n={},r=0,a=Object.entries(t);r<a.length;r++){var o=a[r],c=o[0],i=o[1];switch(typeof i){case"function":n[c]=i.call(n,e[c],c,e);break;case"object":n[c]=Fe(e[c],i);break;case"boolean":i&&(n[c]=e[c])}}return n}function Me(){return"undefined"!=typeof window&&"ontouchstart"in window}function Be(e){return"pointerId"in e?null:"touchend"===e.type?e.changedTouches:e.targetTouches}function Qe(e){return Array.from(Be(e)).map((function(e){return e.identifier}))}function qe(e){return{buttons:"buttons"in e?e.buttons:0,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey}}var Ke=function(e){return e};function Ve(e,t){void 0===t&&(t=Ke);var n=Be(e),r=n?n[0]:e;return t([r.clientX,r.clientY])}var Ge=Te({},{threshold:function(e){return void 0===e&&(e=0),Re(e)},rubberband:function(e){switch(void 0===e&&(e=0),e){case!0:return Re(.15);case!1:return Re(0);default:return Re(e)}},enabled:function(e){return void 0===e&&(e=!0),e},triggerAllEvents:function(e){return void 0===e&&(e=!1),e},initial:function(e){return void 0===e&&(e=0),"function"==typeof e?e:Re(e)},transform:!0},{axis:!0,lockDirection:function(e){return void 0===e&&(e=!1),e},bounds:function(e){if(void 0===e&&(e={}),"function"==typeof e)return function(t){return Ge.bounds(e(t))};var t=e,n=t.left,r=void 0===n?-1/0:n,a=t.right,o=void 0===a?1/0:a,c=t.top,i=void 0===c?-1/0:c,s=t.bottom;return[[r,o],[i,void 0===s?1/0:s]]}}),Ue="undefined"!=typeof window&&window.document&&window.document.createElement,He={enabled:function(e){return void 0===e&&(e=!0),e},domTarget:!0,window:function(e){function t(_x){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){return void 0===e&&(e=Ue?window:void 0),e})),eventOptions:function(e){var t=void 0===e?{}:e,n=t.passive,r=void 0===n||n,a=t.capture;return{passive:r,capture:void 0!==a&&a}},transform:!0},$e=Te({},Ge,{useTouch:function(e){void 0===e&&(e=!1);var t=Me(),n="undefined"!=typeof window&&"onpointerdown"in window;return!(!e||!t)||!(!t||n)},experimental_preventWindowScrollY:function(e){return void 0===e&&(e=!1),e},threshold:function(e,t,n){var r=n.filterTaps,a=void 0!==r&&r,o=n.lockDirection,c=void 0!==o&&o,i=n.axis,s=Re(e,a?3:c||(void 0===i?void 0:i)?1:0);return this.filterTaps=a,s},swipeVelocity:function(e){return void 0===e&&(e=.5),Re(e)},swipeDistance:function(e){return void 0===e&&(e=50),Re(e)},swipeDuration:function(e){return void 0===e&&(e=250),e},delay:function(e){switch(void 0===e&&(e=0),e){case!0:return 180;case!1:return 0;default:return e}}});function ze(e){var t,n=e.domTarget,r=e.eventOptions,a=e.window,o=e.enabled,c=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,["domTarget","eventOptions","window","enabled"]),i=(void 0===(t={domTarget:n,eventOptions:r,window:a,enabled:o})&&(t={}),Fe(t,He));return i.drag=function(e){return void 0===e&&(e={}),Fe(e,$e)}(c),i}function We(e){return Te({_active:!1,_blocked:!1,_intentional:[!1,!1],_movement:[0,0],_initial:[0,0],_bounds:[[-1/0,1/0],[-1/0,1/0]],_threshold:[0,0],_lastEventType:void 0,_dragStarted:!1,_dragPreventScroll:!1,_dragIsTap:!0,_dragDelayed:!1,event:void 0,intentional:!1,values:[0,0],velocities:[0,0],delta:[0,0],movement:[0,0],offset:[0,0],lastOffset:[0,0],direction:[0,0],initial:[0,0],previous:[0,0],first:!1,last:!1,active:!1,timeStamp:0,startTime:0,elapsedTime:0,cancel:Ie,canceled:!1,memo:void 0,args:void 0},e)}function Ye(){return{shared:{hovering:!1,scrolling:!1,wheeling:!1,dragging:!1,moving:!1,pinching:!1,touches:0,buttons:0,down:!1,shiftKey:!1,altKey:!1,metaKey:!1,ctrlKey:!1,locked:!1},drag:We({_pointerId:void 0,axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0,tap:!1,swipe:[0,0]}),pinch:We({_pointerIds:[],da:[0,0],vdva:[0,0],origin:void 0,turns:0}),wheel:We({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),move:We({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),scroll:We({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0})}}var Xe=new Map,Je=function(e){return e};function Ze(e,t){return Math.abs(e)>=t&&Ee(e)*t}function et(e,t,n){var r=t[0],a=t[1],o=n[0],c=n[1],i=e[0],s=i[0],l=i[1],u=e[1],p=u[0],d=u[1];return[Pe(r,s,l,o),Pe(a,p,d,c)]}function tt(e,t,n){var r=e.state,a=t.timeStamp,o=t.type,c=r.values;return{_lastEventType:o,event:t,timeStamp:a,elapsedTime:n?0:a-r.startTime,previous:c}}function nt(e,t,n,r){var a=e.state,o=e.config,c=e.stateKey,i=e.args,s=e.transform,l=a.offset,u=n.timeStamp,p=o.initial,d=o.bounds,f=_e(s(o.threshold),s([0,0])).map(Math.abs),m=Te({},Ye()[c],{_active:!0,args:i,values:t,initial:null!=r?r:t,_threshold:f,offset:l,lastOffset:l,startTime:u});return Te({},m,{_initial:De(p,m),_bounds:De(d,m)})}var rt=function(e){var t=this;this.classes=e,this.pointerIds=new Set,this.touchIds=new Set,this.supportsTouchEvents=Me(),this.supportsGestureEvents=function(){try{return"constructor"in GestureEvent}catch(e){return!1}}(),this.bind=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];for(var a,o={},c=Ae(t.classes);!(a=c()).done;){var i=a.value;new i(t,n).addBindings(o)}var s=function(e){dt(o,e,(function(r){return t.nativeRefs[e](Te({},t.state.shared,{event:r,args:n}))}))};for(var l in t.nativeRefs)s(l);return t.config.domTarget?st(t,o):lt(t,o)},this.effect=function(){return t.config.domTarget&&t.bind(),t.clean},this.clean=function(){var e=pt(t.config),n=t.config.eventOptions;e&&mt(e,ut(t.domListeners),n),Object.values(t.timeouts).forEach(clearTimeout),function(e){var t=e.config,n=t.window,r=t.eventOptions,a=e.windowListeners;if(n){for(var o in a){mt(n,a[o],r)}e.windowListeners={}}}(t)},this.classes=e,this.state=Ye(),this.timeouts={},this.domListeners=[],this.windowListeners={}};function at(e,t){"pointerId"in t?e.pointerIds.add(t.pointerId):e.touchIds=new Set(Qe(t))}function ot(e,t){"pointerId"in t?e.pointerIds.delete(t.pointerId):Qe(t).forEach((function(t){return e.touchIds.delete(t)}))}function ct(e,t,n){var r=e.config,a=e.windowListeners;void 0===n&&(n=r.eventOptions),r.window&&(mt(r.window,a[t],n),delete a[t])}function it(e,t,n,r){var a=e.config,o=e.windowListeners;void 0===n&&(n=[]),void 0===r&&(r=a.eventOptions),a.window&&(mt(a.window,o[t],r),ft(a.window,o[t]=n,r))}function st(e,t){var n=e.config,r=e.domListeners,a=pt(n);if(!a)throw new Error("domTarget must be defined");var o=n.eventOptions;mt(a,ut(r),o);for(var c=0,i=Object.entries(t);c<i.length;c++){var s=i[c],l=s[0],u=s[1],p=l.slice(2).toLowerCase();r.push([p,Le.apply(void 0,u)])}ft(a,r,o)}function lt(e,t){for(var n={},r=e.config.eventOptions.capture?"Capture":"",a=0,o=Object.entries(t);a<o.length;a++){var c=o[a],i=c[0],s=c[1],l=Array.isArray(s)?s:[s];n[i+r]=Le.apply(void 0,l)}return n}function ut(e){return void 0===e&&(e=[]),e.splice(0,e.length)}function pt(e){var t=e.domTarget;return t&&"current"in t?t.current:t}function dt(e,t,n){e[t]||(e[t]=[]),e[t].push(n)}function ft(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,a=Ae(t);!(r=a()).done;){var o=r.value,c=o[0],i=o[1];e.addEventListener(c,i,n)}}function mt(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,a=Ae(t);!(r=a()).done;){var o=r.value,c=o[0],i=o[1];e.removeEventListener(c,i,n)}}function bt(){}function gt(e){"persist"in e&&"function"==typeof e.persist&&e.persist()}var vt=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="dragging",t.stateKey="drag",t.setPointerCapture=function(e){if(!t.config.useTouch&&!document.pointerLockElement){var n=e.target,r=e.pointerId;n&&"setPointerCapture"in n&&n.setPointerCapture(r),t.updateGestureState({_dragTarget:n,_dragPointerId:r})}},t.releasePointerCapture=function(){if(!t.config.useTouch&&!document.pointerLockElement){var e=t.state,n=e._dragTarget,r=e._dragPointerId;if(r&&n&&"releasePointerCapture"in n&&(!("hasPointerCapture"in n)||n.hasPointerCapture(r)))try{n.releasePointerCapture(r)}catch(e){}}},t.preventScroll=function(e){t.state._dragPreventScroll&&e.cancelable&&e.preventDefault()},t.getEventId=function(e){return t.config.useTouch?e.changedTouches[0].identifier:e.pointerId},t.isValidEvent=function(e){return t.state._pointerId===t.getEventId(e)},t.shouldPreventWindowScrollY=t.config.experimental_preventWindowScrollY&&t.controller.supportsTouchEvents,t.setUpWindowScrollDetection=function(e){gt(e),it(t.controller,t.stateKey,[["touchmove",t.preventScroll],["touchend",t.clean.bind(ke(t))],["touchcancel",t.clean.bind(ke(t))]],{passive:!1}),t.setTimeout(t.startDrag.bind(ke(t)),250,e)},t.setUpDelayedDragTrigger=function(e){t.state._dragDelayed=!0,gt(e),t.setTimeout(t.startDrag.bind(ke(t)),t.config.delay,e)},t.setStartState=function(e){var n=Ve(e,t.transform);t.updateSharedState(qe(e)),t.updateGestureState(Te({},nt(ke(t),n,e),tt(ke(t),e,!0),{_pointerId:t.getEventId(e)})),t.updateGestureState(t.getMovement(n))},t.onDragStart=function(e){at(t.controller,e),t.enabled&&!t.state._active&&(t.setStartState(e),t.setPointerCapture(e),t.shouldPreventWindowScrollY?t.setUpWindowScrollDetection(e):t.config.delay>0?t.setUpDelayedDragTrigger(e):t.startDrag(e,!0))},t.onDragChange=function(e){if(!t.state.canceled&&t.state._active&&t.isValidEvent(e)&&(t.state._lastEventType!==e.type||e.timeStamp!==t.state.timeStamp)){var n;if(document.pointerLockElement){var r=e.movementX,a=e.movementY;n=je(t.transform([r,a]),t.state.values)}else n=Ve(e,t.transform);var o=t.getKinematics(n,e);if(!t.state._dragStarted){if(t.state._dragDelayed)return void t.startDrag(e);if(!t.shouldPreventWindowScrollY)return;if(t.state._dragPreventScroll||!o.axis)return;if("x"!==o.axis)return void(t.state._active=!1);t.startDrag(e)}var c=qe(e);t.updateSharedState(c);var i=tt(ke(t),e),s=we(o._movement),l=t.state._dragIsTap;l&&s>=3&&(l=!1),t.updateGestureState(Te({},i,o,{_dragIsTap:l})),t.fireGestureHandler()}},t.onDragEnd=function(e){if(ot(t.controller,e),t.isValidEvent(e)&&(t.clean(),t.state._active)){t.state._active=!1;var n=t.state._dragIsTap,r=t.state.velocities,a=r[0],o=r[1],c=t.state.movement,i=c[0],s=c[1],l=t.state._intentional,u=l[0],p=l[1],d=t.config.swipeVelocity,f=d[0],m=d[1],b=t.config.swipeDistance,g=b[0],v=b[1],h=t.config.swipeDuration,O=Te({},tt(ke(t),e),t.getMovement(t.state.values)),y=[0,0];O.elapsedTime<h&&(!1!==u&&Math.abs(a)>f&&Math.abs(i)>g&&(y[0]=Ee(a)),!1!==p&&Math.abs(o)>m&&Math.abs(s)>v&&(y[1]=Ee(o))),t.updateSharedState({buttons:0}),t.updateGestureState(Te({},O,{tap:n,swipe:y})),t.fireGestureHandler(t.config.filterTaps&&!0===n)}},t.clean=function(){e.prototype.clean.call(ke(t)),t.state._dragStarted=!1,t.releasePointerCapture(),ct(t.controller,t.stateKey)},t.onCancel=function(){t.state.canceled||(t.updateGestureState({canceled:!0,_active:!1}),t.updateSharedState({buttons:0}),setTimeout((function(){return t.fireGestureHandler()}),0))},t.onClick=function(e){t.state._dragIsTap||e.stopPropagation()},t}Ne(t,e);var n=t.prototype;return n.startDrag=function(e,t){void 0===t&&(t=!1),this.state._active&&!this.state._dragStarted&&(t||this.setStartState(e),this.updateGestureState({_dragStarted:!0,_dragPreventScroll:!0,cancel:this.onCancel}),this.clearTimeout(),this.fireGestureHandler())},n.addBindings=function(e){this.config.useTouch?(dt(e,"onTouchStart",this.onDragStart),dt(e,"onTouchMove",this.onDragChange),dt(e,"onTouchEnd",this.onDragEnd),dt(e,"onTouchCancel",this.onDragEnd)):(dt(e,"onPointerDown",this.onDragStart),dt(e,"onPointerMove",this.onDragChange),dt(e,"onPointerUp",this.onDragEnd),dt(e,"onPointerCancel",this.onDragEnd)),this.config.filterTaps&&dt(e,this.controller.config.eventOptions.capture?"onClick":"onClickCapture",this.onClick)},t}(function(e){function t(){return e.apply(this,arguments)||this}Ne(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){return _e(e,t.initial)},n.checkIntentionality=function(e,t){if(!1===e[0]&&!1===e[1])return{_intentional:e,axis:this.state.axis};var n=t.map(Math.abs),r=n[0],a=n[1],o=this.state.axis||(r>a?"x":r<a?"y":void 0);return this.config.axis||this.config.lockDirection?o?this.config.axis&&o!==this.config.axis?{_intentional:e,_blocked:!0,axis:o}:(e["x"===o?1:0]=!1,{_intentional:e,_blocked:!1,axis:o}):{_intentional:[!1,!1],_blocked:!1,axis:o}:{_intentional:e,_blocked:!1,axis:o}},n.getKinematics=function(e,t){var n=this.getMovement(e);if(!n._blocked){var r=t.timeStamp-this.state.timeStamp;Object.assign(n,function(e,t,n){var r=we(t),a=0===r?0:1/r,o=0===n?0:1/n,c=o*r,i=t.map((function(e){return o*e})),s=t.map((function(e){return a*e}));return{velocities:i,velocity:c,distance:we(e),direction:s}}(n.movement,n.delta,r))}return n},n.mapStateValues=function(e){return{xy:e.values,vxvy:e.velocities}},t}(function(){function e(e,t){var n=this;void 0===t&&(t=[]),this.controller=e,this.args=t,this.debounced=!0,this.setTimeout=function(e,t){var r;void 0===t&&(t=140),clearTimeout(n.controller.timeouts[n.stateKey]);for(var a=arguments.length,o=new Array(a>2?a-2:0),c=2;c<a;c++)o[c-2]=arguments[c];n.controller.timeouts[n.stateKey]=(r=window).setTimeout.apply(r,[e,t].concat(o))},this.clearTimeout=function(){clearTimeout(n.controller.timeouts[n.stateKey])},this.fireGestureHandler=function(e){if(void 0===e&&(e=!1),n.state._blocked)return n.debounced||(n.state._active=!1,n.clean()),null;if(!e&&!n.state.intentional&&!n.config.triggerAllEvents)return null;if(n.state.intentional){var t=n.state.active,r=n.state._active;n.state.active=r,n.state.first=r&&!t,n.state.last=t&&!r,n.controller.state.shared[n.ingKey]=r}var a=n.controller.pointerIds.size||n.controller.touchIds.size,o=n.controller.state.shared.buttons>0||a>0,c=Te({},n.controller.state.shared,n.state,n.mapStateValues(n.state),{locked:!!document.pointerLockElement,touches:a,down:o}),i=n.handler(c);return n.state.memo=void 0!==i?i:n.state.memo,c},this.controller=e,this.args=t}var t,n,r=e.prototype;return r.updateSharedState=function(e){Object.assign(this.controller.state.shared,e)},r.updateGestureState=function(e){Object.assign(this.state,e)},r.checkIntentionality=function(e,t){return{_intentional:e,_blocked:!1}},r.getMovement=function(e){var t=this.config.rubberband,n=this.state,r=n._bounds,a=n._initial,o=n._active,c=n._intentional,i=n.lastOffset,s=n.movement,l=n._threshold,u=this.getInternalMovement(e,this.state),p=!1===c[0]?Ze(u[0],l[0]):c[0],d=!1===c[1]?Ze(u[1],l[1]):c[1],f=this.checkIntentionality([p,d],u);if(f._blocked)return Te({},f,{_movement:u,delta:[0,0]});var m=f._intentional,b=u,g=[!1!==m[0]?u[0]-m[0]:0,!1!==m[1]?u[1]-m[1]:0],v=je(g,i),h=o?t:[0,0];return g=et(r,je(g,a),h),Te({},f,{intentional:!1!==m[0]||!1!==m[1],_initial:a,_movement:b,movement:g,values:e,offset:et(r,v,h),delta:_e(g,s)})},r.clean=function(){this.clearTimeout()},t=e,(n=[{key:"config",get:function(){return this.controller.config[this.stateKey]}},{key:"enabled",get:function(){return this.controller.config.enabled&&this.config.enabled}},{key:"state",get:function(){return this.controller.state[this.stateKey]}},{key:"handler",get:function(){return this.controller.handlers[this.stateKey]}},{key:"transform",get:function(){return this.config.transform||this.controller.config.transform||Je}}])&&xe(t.prototype,n),e}()));function ht(e,t){try{return function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,a,o,c;if(Array.isArray(t)){if((r=t.length)!==n.length)return!1;for(a=r;0!=a--;)if(!e(t[a],n[a]))return!1;return!0}if("function"==typeof Map&&t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(c=t.entries();!(a=c.next()).done;)if(!n.has(a.value[0]))return!1;for(c=t.entries();!(a=c.next()).done;)if(!e(a.value[1],n.get(a.value[0])))return!1;return!0}if("function"==typeof Set&&t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(c=t.entries();!(a=c.next()).done;)if(!n.has(a.value[0]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(a=r;0!=a--;)if(!Object.prototype.hasOwnProperty.call(n,o[a]))return!1;if("undefined"!=typeof Element&&t instanceof Element)return!1;for(a=r;0!=a--;)if(!("_owner"===o[a]&&t.$$typeof||e(t[o[a]],n[o[a]])))return!1;return!0}return t!=t&&n!=n}(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}var Ot=n(12),yt=function({label:e,className:t,onDragChange:n,onDragEnd:r,direction:a="left",...o}){const i=function(e,t){void 0===t&&(t={}),Xe.set("drag",vt);var o=Object(Oe.useRef)();return o.current||(o.current=function(e,t){var n,r,a=[],o=!1;return function(){for(var c=arguments.length,i=new Array(c),s=0;s<c;s++)i[s]=arguments[s];return o&&n===this&&t(i,a)||(r=e.apply(this,i),o=!0,n=this,a=i),r}}(ze,ht)),function(e,t,n){void 0===n&&(n={});var r=function(e){var t=new Set;return e.drag&&t.add(Xe.get("drag")),e.wheel&&t.add(Xe.get("wheel")),e.scroll&&t.add(Xe.get("scroll")),e.move&&t.add(Xe.get("move")),e.pinch&&t.add(Xe.get("pinch")),e.hover&&t.add(Xe.get("hover")),t}(e),a=ye.a.useMemo((function(){return new rt(r)}),[]);return a.config=t,a.handlers=e,a.nativeRefs=n,ye.a.useEffect(a.effect,[]),a.config.domTarget?bt:a.bind}({drag:({delta:e,dragging:t})=>{const o="left"===a?-2:2;t?n(e[0]*o):r()}},o.current(t))}();return Object(c.createElement)("div",{className:"pattern-preview__drag-handle "+t},Object(c.createElement)("button",f()({className:"pattern-preview__drag-handle-button","aria-label":e},o,{onKeyDown:e=>{const{keyCode:t}=e;"left"===a&&t===Ot.LEFT||"right"===a&&t===Ot.RIGHT?n(20):("left"===a&&t===Ot.RIGHT||"right"===a&&t===Ot.LEFT)&&n(-20)},onKeyUp:r},i())))},jt=function e({blockContent:t}){const n=Object(me.useViewportMatch)("mobile",">="),r=Object(me.useViewportMatch)("large",">="),a=Object(me.useViewportMatch)("wide",">="),o=Object(me.useInstanceId)(e),[s,l]=Object(c.useState)(window.innerWidth<960?window.innerWidth:960),u=Object(c.useCallback)(e=>l(t=>t+e),[l]),p=()=>{s<280&&l(280)},d=Object(c.useMemo)(()=>n?a?[{label:"Full (1200px)",value:1200},{label:"Default (960px)",value:960},{label:"Medium (480px)",value:480},{label:"Narrow (320px)",value:320}]:r?[{label:"Default (960px)",value:960},{label:"Medium (480px)",value:480},{label:"Narrow (320px)",value:320}]:[{label:Object(i.__)("Medium (480px)","wporg-patterns"),value:480},{label:Object(i.__)("Narrow (320px)","wporg-patterns"),value:320}]:[],[n,r,a]);let f=!1;if(!d.some(e=>e.value===s)){const e=Math.max(Math.floor(s),280);f={
    33/* translators: %s is the width in pixels, ex 600. */
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-patterns/functions.php

    r11121 r11137  
    4747    $suffix       = $script_debug ? '' : '.min';
    4848
     49    // Unregister the parent style so that the version & deps defined here are used.
     50    wp_deregister_style( 'wporg-style' );
    4951    wp_enqueue_style(
    5052        'wporg-style',
Note: See TracChangeset for help on using the changeset viewer.